Commit e02d6883 authored by lixiaofang's avatar lixiaofang

add

parent 60ad98b0
...@@ -109,15 +109,16 @@ def sync_user_similar_score(): ...@@ -109,15 +109,16 @@ def sync_user_similar_score():
logging.error("catch exception,err_msg:%s" % traceback.format_exc()) logging.error("catch exception,err_msg:%s" % traceback.format_exc())
@shared_task @shared_task
def get_tag_count(): def get_tag_count():
try: try:
# 获取搜索推荐热词 # 获取搜索推荐热词
results_registr_tag = list(set(RegisterShowTag.objects.filter(is_deleted=False, is_online=1).values_list("tag_id", flat=True))) results_registr_tag = list(
set(RegisterShowTag.objects.filter(is_deleted=False, is_online=1).values_list("tag_id", flat=True)))
# 获取符合条件的核心词 # 获取符合条件的核心词
results_tag = list(set(Tag.objects.filter(is_online=True, is_deleted=False, collection=1).values_list("id", flat=True))) results_tag = list(
set(Tag.objects.filter(is_online=True, is_deleted=False, collection=1).values_list("id", flat=True)))
redis_registr_tag = "physical:search_hotword:results_registr_tag" redis_registr_tag = "physical:search_hotword:results_registr_tag"
redis_tag = "physical:search_hotword:results_tag" redis_tag = "physical:search_hotword:results_tag"
......
...@@ -59,7 +59,8 @@ def search_hotword(device_id=-1): ...@@ -59,7 +59,8 @@ def search_hotword(device_id=-1):
for item in linucb_recommend_tag_list: for item in linucb_recommend_tag_list:
results_tag_recommend = list( results_tag_recommend = list(
set(Tag.objects.filter(id=item, is_online=True).values_list("name", flat=True))) set(Tag.objects.filter(id=item, is_online=True).values_list("name", flat=True)))
all_tag_name_list.add(results_tag_recommend[0]) if results_tag_recommend:
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)}
......
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