Commit 94c1103b authored by 段英荣's avatar 段英荣

首页feed已读增加灰度

parent faf0c247
......@@ -56,7 +56,7 @@ def get_discover_page_topic_ids(user_id, device_id, size, query_type=TopicPageTy
def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query=None,
query_type=TopicPageType.HOME_RECOMMEND, promote_topic_list=[], disable_collpase=False,
usefulrecall=-1, useful_tag_list=[], has_score= False):
usefulrecall=-1, useful_tag_list=[], has_score= False,is_gray=-1):
try:
topic_star_routing = "6"
index_type = "topic-high-star"
......@@ -221,9 +221,12 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
# 失效时间为第二天凌晨3点
# if redis_client.ttl(redis_key)<0:
today = datetime.datetime.strptime(str(datetime.date.today()), "%Y-%m-%d")
tomorrow = today + datetime.timedelta(days=1)
if is_gray==0:
end_day = today + datetime.timedelta(days=10)
else:
end_day = today + datetime.timedelta(days=1)
nowTime = datetime.datetime.now()
expire_time = (tomorrow - nowTime).seconds + 3 * 60 * 60
expire_time = (end_day - nowTime).seconds + 3 * 60 * 60
redis_client.expire(redis_key, expire_time)
ret_list = rank_topic_id_list if query is None else ret_data_list
......@@ -368,7 +371,7 @@ def query_tag_id_by_topic(offset=0, size=10, topic_id_list=[], user_id=-1):
@bind("physical/search/home_recommend")
def home_recommend(device_id="", user_id=-1, offset=0, lin_pictorial_count=4, size=10, query_type=TopicPageType.HOME_RECOMMEND,
promote_topic_list=[], usefulrecall=-1, useful_tag_list=[], is_debug=False):
promote_topic_list=[], usefulrecall=-1, useful_tag_list=[], is_debug=False,is_gray=-1):
"""
:remark:首页推荐,目前只推荐日记
:param session_id:
......@@ -420,7 +423,7 @@ def home_recommend(device_id="", user_id=-1, offset=0, lin_pictorial_count=4, si
query_type=query_type,
promote_topic_list=promote_topic_list,
usefulrecall=usefulrecall,
useful_tag_list=useful_tag_list, has_score=has_score)
useful_tag_list=useful_tag_list, has_score=has_score,is_gray=is_gray)
else:
has_score = False
......@@ -433,7 +436,7 @@ def home_recommend(device_id="", user_id=-1, offset=0, lin_pictorial_count=4, si
promote_topic_list=promote_topic_list,
usefulrecall=usefulrecall,
useful_tag_list=useful_tag_list,
has_score=has_score)
has_score=has_score,is_gray=is_gray)
if not is_debug:
return {"linucb_topic_ids": recommend_topic_ids, "rank_topic_ids": rank_topic_ids,
"useful_topic_ids": useful_topic_ids, "linucb_pictorial_ids": recommend_pictorial_ids}
......@@ -456,7 +459,7 @@ def home_recommend(device_id="", user_id=-1, offset=0, lin_pictorial_count=4, si
size=size,
query_type=query_type,
promote_topic_list=promote_topic_list,
has_score=has_score)
has_score=has_score,is_gray=is_gray)
else:
has_score = False
......@@ -464,7 +467,7 @@ def home_recommend(device_id="", user_id=-1, offset=0, lin_pictorial_count=4, si
offset=0, size=size,
query_type=query_type,
promote_topic_list=promote_topic_list,
has_score=has_score)
has_score=has_score,is_gray=is_gray)
if not is_debug:
return {"linucb_topic_ids": recommend_topic_ids, "rank_topic_ids": rank_topic_ids,
......
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