Commit 2f14a250 authored by 段英荣's avatar 段英荣

modify

parent 6dc106ab
......@@ -59,14 +59,14 @@ def group_sort(user_id=-1,sort_type=GroupSortTypes.HOT_RECOMMEND,offset=0,size=1
attention_group_id_list = [item["group_id"] for item in attention_group_list]
sorted_group_ids_list = GroupUtils.get_group_ids_by_aggs(attention_group_id_list)
group_recommend_ids_list = sorted_group_ids_list
group_recommend_ids_list = sorted_group_ids_list[offset:(offset+size)]
if len(group_recommend_ids_list) < size and len(group_recommend_ids_list)<len(attention_group_list):
sorted_attention_group_list = sorted(attention_group_list,key=lambda item:item["update_time_val"],reverse=True)
for item in sorted_attention_group_list:
if item["group_id"] not in group_recommend_ids_list:
if item["group_id"] not in sorted_group_ids_list:
group_recommend_ids_list.append(item["group_id"])
return {"group_recommend_ids": group_recommend_ids_list[offset:(offset+size)]}
return {"group_recommend_ids": group_recommend_ids_list}
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
......
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