Commit 1fa190fb authored by Kai's avatar Kai

update

parent 98846057
...@@ -271,13 +271,14 @@ def topic_detail_page_recommend(device_id="", user_id=-1, topic_id=-1, topic_pic ...@@ -271,13 +271,14 @@ def topic_detail_page_recommend(device_id="", user_id=-1, topic_id=-1, topic_pic
redis_key = "physical:topic_detail_recommend" + ":device_id:" + device_id + "topic_id:"+str(topic_id) redis_key = "physical:topic_detail_recommend" + ":device_id:" + device_id + "topic_id:"+str(topic_id)
if offset == 0: if offset == 0:
have_read_topic_list = list() have_read_topic_list = list()
redis_dict = { # redis_dict = {
"have_read_topic_id": json.dumps(have_read_topic_list) # "have_read_topic_id": json.dumps(have_read_topic_list)
} # }
redis_client.hmset(redis_key, redis_dict) redis_client.delete(redis_key)
redis_client.expire(redis_key, 60 * 60 * 24) # redis_client.expire(redis_key, 60 * 60 * 24)
else: else:
have_read_topic_list = list()
redis_field_list = [b'have_read_topic_list'] redis_field_list = [b'have_read_topic_list']
have_read_topic_redis_data = redis_client.hmget(redis_key,redis_field_list) have_read_topic_redis_data = redis_client.hmget(redis_key,redis_field_list)
...@@ -288,7 +289,9 @@ def topic_detail_page_recommend(device_id="", user_id=-1, topic_id=-1, topic_pic ...@@ -288,7 +289,9 @@ def topic_detail_page_recommend(device_id="", user_id=-1, topic_id=-1, topic_pic
topic_tag_result = TopicUtils.top_get_topic_detail_recommend_list(user_id,topic_id,have_read_topic_list,size,es_cli_obj, topic_tag_result = TopicUtils.top_get_topic_detail_recommend_list(user_id,topic_id,have_read_topic_list,size,es_cli_obj,
index_type="topic",routing="4,5,6",topic_tag_list = topic_tag_list) index_type="topic",routing="4,5,6",topic_tag_list = topic_tag_list)
topic_tag_size = len(topic_tag_result) topic_tag_size = len(topic_tag_result)
have_read_topic_list.extend(topic_tag_result) have_read_topic_list.extend(topic_tag_result)
else:
topic_tag_size = 0
if topic_tag_size <size: if topic_tag_size <size:
size = size - topic_tag_size size = size - topic_tag_size
if topic_user_id != -1: if topic_user_id != -1:
...@@ -297,7 +300,7 @@ def topic_detail_page_recommend(device_id="", user_id=-1, topic_id=-1, topic_pic ...@@ -297,7 +300,7 @@ def topic_detail_page_recommend(device_id="", user_id=-1, topic_id=-1, topic_pic
index_type="topic", routing="4,5,6", index_type="topic", routing="4,5,6",
topic_tag_list=topic_tag_list) topic_tag_list=topic_tag_list)
topic_user_size = len(topic_user_result) topic_user_size = len(topic_user_result)
have_read_topic_list.extend(topic_user_result) have_read_topic_list.extend(topic_user_result)
if topic_user_size < size: if topic_user_size < size:
size = size - topic_user_size size = size - topic_user_size
result = TopicUtils.top_get_topic_detail_recommend_list(user_id, topic_id, result = TopicUtils.top_get_topic_detail_recommend_list(user_id, topic_id,
......
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