Commit 9d693cfb authored by 段英荣's avatar 段英荣

modify

parent ce68c272
......@@ -48,7 +48,7 @@ class GroupUtils(object):
return {"total_count":0, "hits":[]}
@classmethod
def get_hot_group_recommend_results(cls,offset,size):
def get_hot_group_recommend_result_list(cls,offset,size):
try:
q = dict()
q["query"] = {
......@@ -67,10 +67,16 @@ class GroupUtils(object):
"include":["id"]
}
return ESPerform.get_search_results(ESPerform.get_cli(),"group",q,offset,size)
result_dict = ESPerform.get_search_results(ESPerform.get_cli(),"group",q,offset,size)
group_ids_list = []
if len(result_dict["hits"]) > 0:
group_ids_list = [item["_source"]["id"] for item in result_dict["hits"]]
return group_ids_list
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return {"total_count":0, "hits":[]}
return []
@classmethod
def get_user_attention_group_list(cls,user_id,offset,size):
......
......@@ -44,10 +44,10 @@ def group_sort(user_id=-1,sort_type=GroupSortTypes.HOT_RECOMMEND,offset=0,size=1
"""
try:
if sort_type==GroupSortTypes.HOT_RECOMMEND:
result_dict = GroupUtils.get_hot_group_recommend_results(offset,size)
group_ids_list = [item.id for item in result_dict["hits"]]
group_ids_list = GroupUtils.get_hot_group_recommend_result_list(offset,size)
return {"group_recommend_ids":group_ids_list}
elif sort_type==GroupSortTypes.ATTENTION_RECOMMEND:
attention_group_list = GroupUtils.get_user_attention_group_list(user_id,offset,size)
if len(attention_group_list)==0:
......
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