Commit 1ea18a3d authored by 段英荣's avatar 段英荣

modify

parent b76aab5e
...@@ -90,7 +90,7 @@ class TopicUtils(object): ...@@ -90,7 +90,7 @@ class TopicUtils(object):
return [] return []
@classmethod @classmethod
def get_recommend_topic_ids(cls,user_id,offset,size,query=None,query_type=TopicPageType.HOME_RECOMMEND,filter_topic_id_list=[]): def get_recommend_topic_ids(cls,user_id,offset,size,query=None,query_type=TopicPageType.FIND_PAGE,filter_topic_id_list=[]):
""" """
:需增加打散逻辑 :需增加打散逻辑
:remark:获取首页推荐帖子列表 :remark:获取首页推荐帖子列表
......
...@@ -12,15 +12,15 @@ from libs.cache import redis_client ...@@ -12,15 +12,15 @@ from libs.cache import redis_client
from search.utils.common import * from search.utils.common import *
def get_discover_page_topic_ids(user_id,device_id,size,query_type=TopicPageType.HOME_RECOMMEND): def get_discover_page_topic_ids(user_id,device_id,size,query_type=TopicPageType.FIND_PAGE):
try: try:
if user_id == -1: if user_id == -1:
redis_key = "physical:discover_page" + ":user_id:" + str(user_id) + ":device_id:" + device_id redis_key = "physical:discover_page" + ":user_id:" + str(user_id) + ":device_id:" + device_id
else: else:
redis_key = "physical:discover_page" + ":user_id:" + str(user_id) redis_key = "physical:discover_page" + ":user_id:" + str(user_id)
redis_field_list = [b'have_read_topic_id'] redis_field_list = b'have_read_topic_id'
redis_field_val_list = redis_client.hmget(redis_key,redis_field_list) redis_field_val_list = redis_client.hget(redis_key,redis_field_list)
have_read_topic_id_list = json.loads(redis_field_val_list[0]) if redis_field_val_list[0] else [] have_read_topic_id_list = json.loads(redis_field_val_list[0]) if redis_field_val_list[0] else []
...@@ -165,7 +165,7 @@ def discover_page(device_id="",user_id=-1,size=10): ...@@ -165,7 +165,7 @@ def discover_page(device_id="",user_id=-1,size=10):
if not isinstance(device_id,str): if not isinstance(device_id,str):
device_id = "" device_id = ""
recommend_topic_ids = get_discover_page_topic_ids(user_id,device_id,size,query_type=TopicPageType.HOME_RECOMMEND) recommend_topic_ids = get_discover_page_topic_ids(user_id,device_id,size,query_type=TopicPageType.FIND_PAGE)
return {"recommend_topic_ids":recommend_topic_ids} return {"recommend_topic_ids":recommend_topic_ids}
except: 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