Commit 61e84543 authored by 段英荣's avatar 段英荣

modify

parent 4b8c5046
......@@ -11,11 +11,8 @@ from libs.cache import redis_client
class PickUtils(object):
@classmethod
def refresh_redis_data(cls,have_read_celebrity_list,redis_cli,redis_key,key_exist):
def refresh_redis_data(cls,have_read_celebrity_list,redis_cli,redis_key):
try:
if key_exist:
redis_cli.set(redis_key,json.dumps(have_read_celebrity_list))
else:
now = datetime.datetime.now()
str_end_time = "%s-%s-%s 23:59:59" % (now.year, now.month, now.day)
......
......@@ -100,10 +100,9 @@ def pick_topic(user_id,pick_id,offset=0,size=10):
if len(result_dict["hits"]) > 0:
recommend_pick_topic_list = [item["_source"]["id"] for item in result_dict["hits"]]
key_exist = len(have_read_pick_topic_ids) > 0
if len(recommend_pick_topic_list) > 0:
PickUtils.refresh_redis_data(have_read_celebrity_list=have_read_pick_topic_ids.extend(recommend_pick_topic_list),
redis_cli=redis_client,redis_key=redis_key,key_exist=key_exist)
redis_cli=redis_client,redis_key=redis_key)
return {"recommend_pick_topic_ids": recommend_pick_topic_list}
......
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