Commit eea2f48e authored by lixiaofang's avatar lixiaofang

修改获取数据的大

parent c7543fdf
...@@ -37,7 +37,7 @@ def search_hotword(device_id=-1): ...@@ -37,7 +37,7 @@ def search_hotword(device_id=-1):
# 获取符合条件的核心词 # 获取符合条件的核心词
results_tag = Tag.objects.filter(is_online=True, collection=1).count() results_tag = Tag.objects.filter(is_online=True, collection=1).count()
tag_id = random.sample(range(1, results_registr_tag), 1) tag_id = random.sample(range(1, results_registr_tag), 6)
results_tag_chose = Tag.objects.filter(id__in=tag_id).values_list("name", flat=True) results_tag_chose = Tag.objects.filter(id__in=tag_id).values_list("name", flat=True)
for i in results_tag_chose: for i in results_tag_chose:
all_tag_name_list.add(i) all_tag_name_list.add(i)
...@@ -52,9 +52,6 @@ def search_hotword(device_id=-1): ...@@ -52,9 +52,6 @@ def search_hotword(device_id=-1):
all_tag_name_list.add(results_tag_recommend[0]) all_tag_name_list.add(results_tag_recommend[0])
if len(all_tag_name_list) == 12: if len(all_tag_name_list) == 12:
return {"recommend_tag_name": list(all_tag_name_list)} return {"recommend_tag_name": list(all_tag_name_list)}
logging.info("get all_tag_name_list02:%s" % all_tag_name_list)
# 取不够数则取核心标签 # 取不够数则取核心标签
if len(all_tag_name_list) < 12: if len(all_tag_name_list) < 12:
for i in range(0, 12): for i in range(0, 12):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment