Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
physical
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
physical
Commits
94c1103b
Commit
94c1103b
authored
Sep 12, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页feed已读增加灰度
parent
faf0c247
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
topic.py
search/views/topic.py
+11
-8
No files found.
search/views/topic.py
View file @
94c1103b
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment