Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
V
vest
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
2
Merge Requests
2
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
vest
Commits
39f3172a
Commit
39f3172a
authored
Jan 09, 2020
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
7e2be98c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
2 deletions
+37
-2
click_fun.py
click/views/click_fun.py
+15
-0
comment_fun.py
comment/views/comment_fun.py
+2
-2
follow_fun.py
follow/views/follow_fun.py
+16
-0
consum.py
moment/views/consum.py
+4
-0
No files found.
click/views/click_fun.py
View file @
39f3172a
...
...
@@ -10,6 +10,21 @@ import datetime
def
click
(
card_info
):
try
:
key
=
'have_reply_answer_click:'
+
str
(
card_info
[
'card_id'
])
redis_data
=
redis_client
.
get
(
key
)
if
redis_data
:
datas
=
json
.
loads
(
str
(
redis_data
,
encoding
=
"utf-8"
))
if
card_info
[
'current_user_id'
]
in
datas
:
logging
.
info
(
"当前需要去点赞的用户已经存在了:
%
s"
%
card_info
)
return
False
else
:
datas
.
append
(
card_info
[
'current_user_id'
])
redis_client
.
set
(
key
,
json
.
dumps
(
datas
))
else
:
conent
=
[
card_info
[
'current_user_id'
]]
redis_client
.
set
(
key
,
json
.
dumps
(
conent
))
today
=
datetime
.
datetime
.
now
()
str_today
=
str
(
today
.
year
)
+
str
(
today
.
month
)
+
str
(
today
.
day
)
...
...
comment/views/comment_fun.py
View file @
39f3172a
...
...
@@ -111,8 +111,8 @@ def comment(card_info):
if
redis_data
:
datas
=
json
.
loads
(
str
(
redis_data
,
encoding
=
"utf-8"
))
if
card_info
[
'comment_content'
]
in
datas
:
logging
.
info
(
"当前评论和当前的用户已经存在了
"
)
return
Tru
e
logging
.
info
(
"当前评论和当前的用户已经存在了
:
%
s"
%
card_info
)
return
Fals
e
else
:
datas
.
append
(
card_info
[
'comment_content'
])
...
...
follow/views/follow_fun.py
View file @
39f3172a
...
...
@@ -10,6 +10,22 @@ import datetime
def
follow
(
card_info
):
try
:
key
=
'have_reply_answer_follow:'
+
str
(
card_info
[
'card_id'
])
redis_data
=
redis_client
.
get
(
key
)
if
redis_data
:
datas
=
json
.
loads
(
str
(
redis_data
,
encoding
=
"utf-8"
))
if
card_info
[
'current_user_id'
]
in
datas
:
logging
.
info
(
"当前需要去关注的用户已经存在了:
%
s"
%
card_info
)
return
False
else
:
datas
.
append
(
card_info
[
'current_user_id'
])
redis_client
.
set
(
key
,
json
.
dumps
(
datas
))
else
:
conent
=
[
card_info
[
'current_user_id'
]]
redis_client
.
set
(
key
,
json
.
dumps
(
conent
))
today
=
datetime
.
datetime
.
now
()
str_today
=
str
(
today
.
year
)
+
str
(
today
.
month
)
+
str
(
today
.
day
)
key
=
"auto_vest_action_follow_answer:"
+
str
(
card_info
[
'card_id'
])
...
...
moment/views/consum.py
View file @
39f3172a
...
...
@@ -115,6 +115,7 @@ def kafka_consum(topic_name=None):
logging
.
info
(
"当前卡片ID:
%
s,comment2子函数消费处理耗时:
%
f"
%
(
card_info
[
'card_id'
],
time
.
time
()
-
begin
))
# 调完接口后需要再次去拿新的push_time的时间
if
is_success
:
auto_comment_user
(
card_info
)
elif
action_type
==
"click"
:
# 在这里去调点赞的接口
...
...
@@ -129,6 +130,8 @@ def kafka_consum(topic_name=None):
card_info
[
"card_id"
],
is_success
))
logging
.
info
(
"当前卡片ID:
%
s,click2子函数消费处理耗时:
%
f"
%
(
card_info
[
"card_id"
],
time
.
time
()
-
begin
))
if
is_success
:
auto_click_user
(
card_info
)
elif
action_type
==
"follow"
:
# 在这里去调关注的接口
...
...
@@ -144,6 +147,7 @@ def kafka_consum(topic_name=None):
str
(
msg
.
topic
),
str
(
msg
.
partition
),
str
(
msg
.
offset
),
str
(
msg
.
key
),
card_info
[
"card_id"
],
is_success
))
if
is_success
:
auto_follow_user
(
card_info
)
else
:
# push_time时间未到 需要等待
logging
.
info
(
"follow [
%
s,
%
s,
%
s,
%
s],push_time未到,需要等待"
%
(
...
...
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