修复了财报搜索接口使用关键词查询时的总是返回空值的问题

This commit is contained in:
mxwj 2024-11-09 22:08:16 +08:00
parent 4cf37185cd
commit 01c80653d9

@ -51,8 +51,8 @@ async def financial_reports_query_service(
# 如果没有匹配的股票代码,返回空查询 # 如果没有匹配的股票代码,返回空查询
query_set = query_set.none() query_set = query_set.none()
elif keyword_type == "code": elif keyword_type == "code":
# 精确查询股票代码字段 # 模糊查询代码
query_set = query_set.filter(stock_code=search_keyword) query_set = query_set.filter(stock_code__icontains=search_keyword)
elif keyword_type == "chinese": elif keyword_type == "chinese":
# 模糊查询股票名称字段 # 模糊查询股票名称字段
query_set = query_set.filter(stock_name__icontains=search_keyword) query_set = query_set.filter(stock_name__icontains=search_keyword)