Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
gm_strategy_cvr
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
rank
gm_strategy_cvr
Commits
37d76d17
Commit
37d76d17
authored
Jul 23, 2020
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
write data
parent
0138feda
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
5 deletions
+28
-5
main_portrait.py
src/main_portrait.py
+5
-5
portrait.py
src/utils/portrait.py
+23
-0
No files found.
src/main_portrait.py
View file @
37d76d17
import
datetime
import
datetime
from
utils.cache
import
redis_client2
from
utils.cache
import
redis_client2
from
utils.portrait
import
user_portrait_tag3_get_candidate_unread_list
from
utils.portrait
import
user_portrait_tag3_get_candidate_unread_list
,
user_portrait_tag3_write_ctcvr_data
def
user_portrait_scan_info
():
def
user_portrait_scan_info
():
...
@@ -28,7 +28,7 @@ def user_portrait_scan_info():
...
@@ -28,7 +28,7 @@ def user_portrait_scan_info():
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
#
device_id = "androidid_a25a1129c0b38f7b"
device_id
=
"androidid_a25a1129c0b38f7b"
# res = user_portrait_tag3_get_candidate_unread_list(device_id, "diary")
a
=
[
15420031
,
15531030
,
16049931
,
15335637
,
16443431
,
16269779
,
9389022
,
16710435
,
16258498
,
16435592
]
# print(res
)
user_portrait_tag3_write_ctcvr_data
(
device_id
,
"diary"
,
a
)
user_portrait_scan_info
()
#
user_portrait_scan_info()
src/utils/portrait.py
View file @
37d76d17
...
@@ -69,6 +69,15 @@ def remove_read_with_size(lol, content_type, read_list, size=500):
...
@@ -69,6 +69,15 @@ def remove_read_with_size(lol, content_type, read_list, size=500):
return
res
return
res
def
_user_portrait_tag3_get_ctcvr_candidate_key
(
device_id
,
content_type
):
"""
device_id:
content_type: diary
return:
"""
return
"doris:user_portrait:tag3:ctcvr:candidate:{}:device_id:"
.
format
(
content_type
)
+
str
(
device_id
)
def
_user_portrait_tag3_get_candidate_key
(
device_id
,
content_type
,
latest
=
False
):
def
_user_portrait_tag3_get_candidate_key
(
device_id
,
content_type
,
latest
=
False
):
"""
"""
content_type: diary, tractate, answer
content_type: diary, tractate, answer
...
@@ -122,3 +131,17 @@ def user_portrait_tag3_get_candidate_unread_list(device_id, content_type):
...
@@ -122,3 +131,17 @@ def user_portrait_tag3_get_candidate_unread_list(device_id, content_type):
lol
=
remove_read_with_size
(
diary_dict
.
values
(),
"diary"
,
read_list
,
500
)
lol
=
remove_read_with_size
(
diary_dict
.
values
(),
"diary"
,
read_list
,
500
)
queue
=
merge_lists
(
*
lol
)
queue
=
merge_lists
(
*
lol
)
return
queue
return
queue
def
user_portrait_tag3_write_ctcvr_data
(
device_id
,
content_type
,
data
):
"""
device_id:
content_type: diary
data: [15420031, 15531030, 16049931, 15335637, 16443431]
return:
"""
if
data
:
key
=
_user_portrait_tag3_get_ctcvr_candidate_key
(
device_id
,
content_type
)
redis_client4
.
delete
(
key
)
redis_client4
.
rpush
(
key
,
*
data
)
redis_client4
.
expire
(
key
,
60
*
60
*
24
*
30
)
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