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
9b2e6460
Commit
9b2e6460
authored
Dec 31, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
json
parent
eae2a9bb
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
8 deletions
+12
-8
click_fun.py
click/views/click_fun.py
+3
-2
comment_fun.py
comment/views/comment_fun.py
+3
-2
follow_fun.py
follow/views/follow_fun.py
+3
-2
consum.py
moment/views/consum.py
+1
-1
process_time.py
moment/views/process_time.py
+1
-1
send_email.py
moment/views/send_email.py
+1
-0
No files found.
click/views/click_fun.py
View file @
9b2e6460
...
...
@@ -12,7 +12,7 @@ def click(card_info):
key
=
"auto_vest_one_user_action:"
+
str
(
card_info
[
'card_id'
])
redis_data
=
redis_client
.
get
(
key
)
if
redis_data
:
redis_data
=
json
.
loads
(
redis_data
)
redis_data
=
json
.
loads
(
str
(
redis_data
,
encoding
=
"utf8"
)
)
click_num
=
int
(
redis_data
.
get
(
"click"
))
+
1
redis_data
[
'click'
]
=
click_num
redis_client
.
set
(
key
,
json
.
dumps
(
redis_data
))
...
...
@@ -23,7 +23,8 @@ def click(card_info):
logging
.
info
(
"get action:click,card_id:
%
s,redis_data:
%
s"
%
(
card_info
[
'card_id'
],
redis_data
))
click_num
=
redis_data
[
"click"
]
if
click_num
>
10
:
send_email_tome
(
str
(
redis_data
)
+
str
(
card_info
))
return
True
# send_email_tome(str(redis_data) + str(card_info))
else
:
rpc_invoker
=
get_rpc_invoker
()
rpc_invoker
[
'qa/irrigation/create_answer_vote'
](
user_id
=
card_info
[
'current_user_id'
],
...
...
comment/views/comment_fun.py
View file @
9b2e6460
...
...
@@ -12,7 +12,7 @@ def comment(card_info):
key
=
"auto_vest_one_user_action:"
+
str
(
card_info
[
'card_id'
])
redis_data
=
redis_client
.
get
(
key
)
if
redis_data
:
redis_data
=
json
.
loads
(
redis_data
)
redis_data
=
json
.
loads
(
str
(
redis_data
,
encoding
=
"utf8"
)
)
click_num
=
int
(
redis_data
.
get
(
"comment"
))
+
1
redis_data
[
'comment'
]
=
click_num
redis_client
.
set
(
key
,
json
.
dumps
(
redis_data
))
...
...
@@ -24,7 +24,8 @@ def comment(card_info):
comment_num
=
redis_data
[
"comment"
]
####在这里做判断 一天不能超过20个 如果超过二十个不下发 不超过二十个下发对应的灌水功能
if
comment_num
>
20
:
send_email_tome
(
str
(
redis_data
)
+
str
(
card_info
))
return
True
# send_email_tome(str(redis_data) + str(card_info))
else
:
rpc_invoker
=
get_rpc_invoker
()
rpc_invoker
[
'qa/irrigation/create_answer_reply'
](
user_id
=
card_info
[
'current_user_id'
],
...
...
follow/views/follow_fun.py
View file @
9b2e6460
...
...
@@ -12,7 +12,7 @@ def follow(card_info):
key
=
"auto_vest_one_user_action:"
+
str
(
card_info
[
'card_id'
])
redis_data
=
redis_client
.
get
(
key
)
if
redis_data
:
redis_data
=
json
.
loads
(
redis_data
)
redis_data
=
json
.
loads
(
str
(
redis_data
,
encoding
=
"utf8"
)
)
click_num
=
int
(
redis_data
.
get
(
"follow"
))
+
1
redis_data
[
'follow'
]
=
click_num
redis_client
.
set
(
key
,
json
.
dumps
(
redis_data
))
...
...
@@ -25,7 +25,8 @@ def follow(card_info):
follow_num
=
redis_data
[
"follow"
]
if
follow_num
>
10
:
send_email_tome
(
str
(
redis_data
)
+
str
(
card_info
))
return
True
# send_email_tome(str(redis_data) + str(card_info))
else
:
rpc_invoker
=
get_rpc_invoker
()
rpc_invoker
[
'api/irrigation/user_add_follow'
](
follow_user_id
=
card_info
[
'current_user_id'
],
...
...
moment/views/consum.py
View file @
9b2e6460
...
...
@@ -38,7 +38,7 @@ def kafka_consum(topic_name=None):
for
msg_key
in
msg_dict
:
consume_msg
=
msg_dict
[
msg_key
]
for
msg
in
consume_msg
:
card_info
=
json
.
loads
(
msg
.
value
)
card_info
=
json
.
loads
(
str
(
msg
.
value
,
encoding
=
"utf8"
)
)
if
card_info
[
'card_type'
]
==
"auto_vest"
:
logging
.
info
(
"消费到新数据了[
%
s,
%
s,
%
s,
%
s],get card_info:
%
s"
%
(
str
(
msg
.
topic
),
str
(
msg
.
partition
),
str
(
msg
.
offset
),
str
(
msg
.
key
),
card_info
))
...
...
moment/views/process_time.py
View file @
9b2e6460
...
...
@@ -296,7 +296,7 @@ def get_vest_userid_and_comment(need_comment_num=0, tag_names=[], card_id=0):
for
item
in
tag_names
:
if
item
in
all_keys_name
:
service_closure_tags
=
redis_client
.
hget
(
redis_key
,
item
)
closure_tags
=
json
.
loads
(
s
ervice_closure_tags
)
closure_tags
=
json
.
loads
(
s
tr
(
service_closure_tags
,
encoding
=
"utf-8"
)
)
all_comment_list
.
extend
(
closure_tags
)
if
all_comment_list
:
content
=
random
.
sample
(
all_comment_list
,
need_comment_num
)
...
...
moment/views/send_email.py
View file @
9b2e6460
...
...
@@ -23,3 +23,4 @@ def send_email_tome(stat_data):
server
.
quit
()
except
Exception
:
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
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