Commit a49fd04e authored by 段英荣's avatar 段英荣

modify

parent 71e62443
......@@ -32,8 +32,8 @@ def home_recommend(session_id="",user_id=-1,offset=0,size=10):
have_read_topic_id_tuple = set()
if len(redis_val_dict)>0:
topic_id_list = redis_val_dict[b"unread_topic_id"] + topic_id_list
have_read_topic_id_tuple = set(redis_val_dict[b"have_read_topic_id"])
topic_id_list = json.loads(redis_val_dict[b"unread_topic_id"]) + topic_id_list
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)
......@@ -53,8 +53,8 @@ def home_recommend(session_id="",user_id=-1,offset=0,size=10):
if len(unread_topic_id_list)>0:
redis_dict = {
"unread_topic_id":unread_topic_id_list,
"have_read_topic_id":have_read_topic_id_tuple
"unread_topic_id":json.dumps(unread_topic_id_list),
"have_read_topic_id":json.dumps(have_read_topic_id_tuple)
}
redis_client.hmset(redis_key,redis_dict)
......@@ -89,8 +89,8 @@ def home_query(session_id="",user_id=-1,query="",offset=0,size=10):
have_read_topic_id_tuple = set()
if len(redis_val_dict)>0:
topic_id_list = redis_val_dict[b"unread_topic_id"] + topic_id_list
have_read_topic_id_tuple = set(redis_val_dict[b"have_read_topic_id"])
topic_id_list = json.loads(redis_val_dict[b"unread_topic_id"]) + topic_id_list
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)
......@@ -110,8 +110,8 @@ def home_query(session_id="",user_id=-1,query="",offset=0,size=10):
if len(unread_topic_id_list)>0:
redis_dict = {
"unread_topic_id":unread_topic_id_list,
"have_read_topic_id":have_read_topic_id_tuple
"unread_topic_id":json.dumps(unread_topic_id_list),
"have_read_topic_id":json.dumps(have_read_topic_id_tuple)
}
redis_client.hmset(redis_key,redis_dict)
......
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