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
alpha
physical
Commits
b36986a0
Commit
b36986a0
authored
Sep 30, 2019
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工厂模式,查询用户lin信息增加灰度,删除掉无用接口
parent
5cc6897c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
27 deletions
+6
-27
topic.py
search/views/topic.py
+6
-27
No files found.
search/views/topic.py
View file @
b36986a0
...
...
@@ -830,30 +830,7 @@ def clear_history(device_id=None, user_id=-1):
return
[
'fail'
]
@bind
(
"physical/search/home_recommend_debug"
)
def
home_recommend_debug
(
device_id
=
""
,
user_id
=-
1
,
recommend_topic_ids
=
[],
rank_topic_ids
=
[],
recommend_pictorial_ids
=
[]):
"""
:remark:首页推荐,目前只推荐日记
:param session_id:
:param user_id:
:param offset:
:param size:
:return:
"""
try
:
if
device_id
:
results
=
get_topic_and_pictorial_detail_for_debug
(
device_id
,
recommend_topic_ids
,
rank_topic_ids
,
recommend_pictorial_ids
)
return
results
else
:
return
{}
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
{}
def
get_device_linucb_tag
(
device_id
=
None
,
size
=
20
,
has_score
=
False
):
def
get_device_linucb_tag
(
device_id
=
None
,
size
=
20
,
has_score
=
False
,
gray_list
=
[]):
# {
# "lincub": [{"id": 1, "name": 名字}, {"id": 2, "name": 名字}, {"id": 3, "name": 名字}, {"id": 5, "name": 名字},
# {"id": 6, "name": 名字}, ]
...
...
@@ -861,7 +838,10 @@ def get_device_linucb_tag(device_id=None, size=20, has_score=False):
try
:
user_feature
=
[
1
,
1
]
if
device_id
:
linucb_matrix_redis_prefix
=
"physical:linucb:device_id:"
if
STRATEGY_TYPE
.
CTR_GRAY
in
gray_list
:
linucb_matrix_redis_prefix
=
"ctr_physical:linucb:device_id:"
else
:
linucb_matrix_redis_prefix
=
"physical:linucb:device_id:"
redis_key
=
linucb_matrix_redis_prefix
+
str
(
device_id
)
redis_linucb_tag_data_dict
=
redis_client
.
hgetall
(
redis_key
)
if
len
(
redis_linucb_tag_data_dict
)
==
0
:
...
...
@@ -885,7 +865,6 @@ def get_device_linucb_tag(device_id=None, size=20, has_score=False):
for
id
,
name
in
tag_query_results
:
linucb_tag_dict_list
.
append
({
"id"
:
id
,
"name"
:
name
})
return
linucb_tag_dict_list
else
:
return
{
"linucb"
:
[]}
except
:
...
...
@@ -894,7 +873,7 @@ def get_device_linucb_tag(device_id=None, size=20, has_score=False):
def
get_edit_tag_name
(
tag_lst
):
try
:
tag_query_results
=
Tag
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
tag_query_results
=
Tag
.
objects
.
using
(
settings
.
SLAVE
1
_DB_NAME
)
.
filter
(
id__in
=
tag_lst
,
is_online
=
True
,
is_deleted
=
False
)
.
values_list
(
"id"
,
"name"
)
tag_dict
=
dict
()
for
id
,
name
in
tag_query_results
:
...
...
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