Commit f756ee0f authored by lixiaofang's avatar lixiaofang

add

parent eb92d6a1
......@@ -148,9 +148,6 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
for item in result_dict["hits"]:
pict_pictorial_ids_list = item["_source"]["pictorial_id"]
topic_tag_list = item["_source"]["tag_list"]
logging.info("get pict_pictorial_ids_list:%s" % pict_pictorial_ids_list)
logging.info("get topic_tag_list:%s" % topic_tag_list)
##先拿到当前帖子对应的标签的分类ID
tag_type_ids = CommunityCategoryTagRelation.objects.filter(tag_id__in=topic_tag_list,
is_online=True, is_deleted=False).values_list(
......@@ -196,11 +193,9 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
pictorial_id_list.append(pictorial_id)
functions_list = []
logging.info("get pictorial_id_list:%s" % pictorial_id_list)
all_tag = []
all_tag.extend(topic_tag_list)
all_tag.extend(tag_type_ids)
logging.info("get all_tag:%s" % all_tag)
# 如果不够10个去拿所属标签的榜单和所属分类的标签的榜单
if len(pictorial_id_list) < 10 and len(all_tag) > 0:
num = 10 - len(pictorial_id_list)
......@@ -267,22 +262,16 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
]
result_dict = ESPerform.get_search_results(es_cli_obj, "pictorial", q, 0, 10)
logging.info("get result_dict:%s" % result_dict)
if len(result_dict["hits"]) > 0:
for item in result_dict["hits"]:
id = item["_source"]["id"]
if id not in pictorial_id_list:
pictorial_id_list.append(id) #
logging.info("get pictorial_id_list:%s" % pictorial_id_list)
pictorial_list = pictorial_id_list if len(pictorial_id_list) < 10 else pictorial_id_list[:10]
return {"pictorial_ids_list": pictorial_list}
else:
return {"pictorial_ids_list": pictorial_id_list}
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return {"pictorial_ids_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