Commit 260be532 authored by 段英荣's avatar 段英荣

modify

parent 2c1e418b
......@@ -40,7 +40,7 @@ def home_recommend(session_id="",user_id=-1,offset=0,size=10):
have_read_topic_id_tuple = set(json.loads(redis_val_dict[b"have_read_topic_id"]))
for item in topic_id_list:
if item["group_id"] in have_read_group_id_tuple:
unread_topic_id_list.append(item["id"])
unread_topic_id_list.append(item)
else:
if item["id"] not in have_read_topic_id_tuple:
recommend_topic_ids.append(item["id"])
......@@ -52,7 +52,8 @@ def home_recommend(session_id="",user_id=-1,offset=0,size=10):
break
if len(recommend_topic_ids) < size and len(unread_topic_id_list)>0:
recommend_len = len(recommend_topic_ids)
recommend_topic_ids = recommend_topic_ids + unread_topic_id_list[:(size-recommend_len)]
offi_unread_topic_id = [item["id"] for item in unread_topic_id_list[:(size-recommend_len)]]
recommend_topic_ids = recommend_topic_ids + offi_unread_topic_id
unread_topic_id_list = unread_topic_id_list[(size-recommend_len):]
if len(unread_topic_id_list)>0:
......@@ -101,7 +102,7 @@ def home_query(session_id="",user_id=-1,query="",offset=0,size=10):
have_read_topic_id_tuple = set(json.loads(redis_val_dict[b"have_read_topic_id"]))
for item in topic_id_list:
if item["group_id"] in have_read_group_id_tuple:
unread_topic_id_list.append(item["id"])
unread_topic_id_list.append(item)
else:
if item["id"] not in have_read_topic_id_tuple:
recommend_topic_ids.append(item["id"])
......@@ -113,7 +114,8 @@ def home_query(session_id="",user_id=-1,query="",offset=0,size=10):
break
if len(recommend_topic_ids) < size and len(unread_topic_id_list)>0:
recommend_len = len(recommend_topic_ids)
recommend_topic_ids = recommend_topic_ids + unread_topic_id_list[:(size-recommend_len)]
offi_unread_topic_id = [item["id"] for item in unread_topic_id_list[:(size-recommend_len)]]
recommend_topic_ids = recommend_topic_ids + offi_unread_topic_id
unread_topic_id_list = unread_topic_id_list[(size-recommend_len):]
if len(unread_topic_id_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