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
f68a03ae
Commit
f68a03ae
authored
Jan 04, 2020
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改评论
parent
97293b2d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
comment_fun.py
comment/views/comment_fun.py
+11
-8
process_time.py
moment/views/process_time.py
+2
-2
No files found.
comment/views/comment_fun.py
View file @
f68a03ae
...
@@ -6,6 +6,7 @@ from libs.cache import redis_client
...
@@ -6,6 +6,7 @@ from libs.cache import redis_client
import
json
import
json
from
moment.views.send_email
import
send_email_tome
from
moment.views.send_email
import
send_email_tome
import
datetime
import
datetime
from
moment.views.process_time
import
get_vest_userid_and_comment
def
comment
(
card_info
):
def
comment
(
card_info
):
...
@@ -74,6 +75,7 @@ def comment(card_info):
...
@@ -74,6 +75,7 @@ def comment(card_info):
rpc_invoker
[
'qa/irrigation/create_answer_reply'
](
user_id
=
card_info
[
'current_user_id'
],
rpc_invoker
[
'qa/irrigation/create_answer_reply'
](
user_id
=
card_info
[
'current_user_id'
],
answer_id
=
card_info
[
'card_id'
],
answer_id
=
card_info
[
'card_id'
],
content
=
card_info
[
'comment_content'
])
.
unwrap
()
content
=
card_info
[
'comment_content'
])
.
unwrap
()
else
:
else
:
today
=
datetime
.
datetime
.
now
()
today
=
datetime
.
datetime
.
now
()
str_today
=
str
(
today
.
year
)
+
str
(
today
.
month
)
+
str
(
today
.
day
)
str_today
=
str
(
today
.
year
)
+
str
(
today
.
month
)
+
str
(
today
.
day
)
...
@@ -93,18 +95,19 @@ def comment(card_info):
...
@@ -93,18 +95,19 @@ def comment(card_info):
logging
.
info
(
"get action:comment,card_id:
%
s,redis_data:
%
s"
%
(
card_info
[
'card_id'
],
redis_data
))
logging
.
info
(
"get action:comment,card_id:
%
s,redis_data:
%
s"
%
(
card_info
[
'card_id'
],
redis_data
))
comment_num
=
redis_data
[
"comment"
]
comment_num
=
redis_data
[
"comment"
]
###判断一下如果评论为空就重新拿一个
####在这里做判断 一天不能超过20个 如果超过二十个不下发 不超过二十个下发对应的灌水功能
if
not
card_info
[
'comment_content'
]:
comment
=
get_vest_userid_and_comment
(
need_comment_num
=
1
,
tag_names
=
card_info
[
'tag_name'
])[
0
]
card_info
[
'comment_content'
]
=
comment
####在这里做判断 一天不能超过12个 如果超过二十个不下发 不超过二十个下发对应的灌水功能
if
comment_num
>
12
:
if
comment_num
>
12
:
return
True
return
True
# send_email_tome(str(redis_data) + str(card_info))
# send_email_tome(str(redis_data) + str(card_info))
else
:
else
:
print
(
"answer"
)
rpc_invoker
=
get_rpc_invoker
()
rpc_invoker
[
'qa/irrigation/create_answer_reply'
](
user_id
=
card_info
[
'current_user_id'
],
# rpc_invoker = get_rpc_invoker()
answer_id
=
card_info
[
'card_id'
],
# rpc_invoker['qa/irrigation/create_answer_reply'](user_id=card_info['current_user_id'],
content
=
card_info
[
'comment_content'
])
.
unwrap
()
# answer_id=card_info['card_id'],
# content=card_info['comment_content']).unwrap()
return
True
return
True
except
:
except
:
logging_exception
()
logging_exception
()
...
...
moment/views/process_time.py
View file @
f68a03ae
...
@@ -320,10 +320,10 @@ def get_vest_userid_and_comment(need_comment_num=0, tag_names=[], card_id=0):
...
@@ -320,10 +320,10 @@ def get_vest_userid_and_comment(need_comment_num=0, tag_names=[], card_id=0):
if
all_comment_list
:
if
all_comment_list
:
content
=
random
.
sample
(
all_comment_list
,
need_comment_num
)
content
=
random
.
sample
(
all_comment_list
,
need_comment_num
)
else
:
else
:
content
=
None
content
=
[]
else
:
else
:
content
=
None
content
=
[]
return
content
return
content
except
:
except
:
...
...
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