Commit 1087ed98 authored by Kai's avatar Kai

update

parent 877065fa
...@@ -79,7 +79,7 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query ...@@ -79,7 +79,7 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
have_read_topic_id_list.extend(promote_topic_list) have_read_topic_id_list.extend(promote_topic_list)
useful_topic_id_list = list() useful_topic_id_list = list()
#有用标签召回 #有用标签召回
if usefulrecall != -1: if usefulrecall != -1 and user_id != -1:
useful_topic_id_list = TopicUtils.userful_tag_topic_list(user_id,have_read_topic_id_list,4,"topic-high-star","6") useful_topic_id_list = TopicUtils.userful_tag_topic_list(user_id,have_read_topic_id_list,4,"topic-high-star","6")
# user_similar_score_redis_key = "physical:user_similar_score:user_id:" + str(user_id) # user_similar_score_redis_key = "physical:user_similar_score:user_id:" + str(user_id)
# redis_user_similar_score_redis_val = redis_client.get(user_similar_score_redis_key) # redis_user_similar_score_redis_val = redis_client.get(user_similar_score_redis_key)
...@@ -100,8 +100,9 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query ...@@ -100,8 +100,9 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
linucb_recommend_topic_id_list = json.loads(recommend_topic_dict[b"data"]) linucb_recommend_topic_id_list = json.loads(recommend_topic_dict[b"data"])
# 推荐帖子是强插的,要保证推荐帖子不在已读里 # 推荐帖子是强插的,要保证推荐帖子不在已读里
recommend_topic_id_list = list(set(linucb_recommend_topic_id_list) - set(have_read_topic_id_list)) if linucb_recommend_topic_id_list != None:
recommend_topic_id_list.sort(key=linucb_recommend_topic_id_list.index) recommend_topic_id_list = list(set(linucb_recommend_topic_id_list) - set(have_read_topic_id_list))
recommend_topic_id_list.sort(key=linucb_recommend_topic_id_list.index)
# cursor = int(str(recommend_topic_dict[b"cursor"], encoding="utf-8")) # cursor = int(str(recommend_topic_dict[b"cursor"], encoding="utf-8"))
# newcursor = cursor + 6 # newcursor = cursor + 6
if len(recommend_topic_id_list) > 0: if len(recommend_topic_id_list) > 0:
...@@ -110,7 +111,7 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query ...@@ -110,7 +111,7 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
if b"datadict" in recommend_topic_dict: if b"datadict" in recommend_topic_dict:
linucb_recommend_topic_id_dict = json.loads(recommend_topic_dict[b"datadict"]) linucb_recommend_topic_id_dict = json.loads(recommend_topic_dict[b"datadict"])
if len(recommend_topic_list) == 6 and linucb_recommend_topic_id_dict is not None: if linucb_recommend_topic_id_dict is not None:
for i in recommend_topic_list: for i in recommend_topic_list:
recommend_topic_user_list.append(linucb_recommend_topic_id_dict[str(i)]) recommend_topic_user_list.append(linucb_recommend_topic_id_dict[str(i)])
# 用户关注标签 # 用户关注标签
......
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