Commit 7645ed61 authored by 段英荣's avatar 段英荣

modify

parent 1b43277a
......@@ -57,15 +57,15 @@ def home_recommend(session_id="",user_id=-1,offset=0,size=10):
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:
redis_dict = {
"unread_topic_id":json.dumps(unread_topic_id_list),
"have_read_topic_id":json.dumps(list(have_read_topic_id_tuple)),
"last_offset_num":offset+size
}
redis_client.hmset(redis_key,redis_dict)
# 每个session key保存15分钟
redis_client.expire(redis_key,15*60*60)
#if len(unread_topic_id_list)>0:
redis_dict = {
"unread_topic_id":json.dumps(unread_topic_id_list),
"have_read_topic_id":json.dumps(list(have_read_topic_id_tuple)),
"last_offset_num":offset+size
}
redis_client.hmset(redis_key,redis_dict)
# 每个session key保存15分钟
redis_client.expire(redis_key,15*60*60)
return {"recommend_topic_ids":recommend_topic_ids}
except:
......@@ -121,15 +121,15 @@ def home_query(session_id="",user_id=-1,query="",offset=0,size=10):
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:
redis_dict = {
"unread_topic_id":json.dumps(unread_topic_id_list),
"have_read_topic_id":json.dumps(list(have_read_topic_id_tuple)),
"last_offset_num":offset+size
}
redis_client.hmset(redis_key,redis_dict)
# 每个session key保存15分钟
redis_client.expire(redis_key,15*60*60)
#if len(unread_topic_id_list)>0:
redis_dict = {
"unread_topic_id":json.dumps(unread_topic_id_list),
"have_read_topic_id":json.dumps(list(have_read_topic_id_tuple)),
"last_offset_num":offset+size
}
redis_client.hmset(redis_key,redis_dict)
# 每个session key保存15分钟
redis_client.expire(redis_key,15*60*60)
return {"recommend_topic_ids":recommend_topic_ids}
except:
......
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