Commit f68a03ae authored by lixiaofang's avatar lixiaofang

修改评论

parent 97293b2d
......@@ -6,6 +6,7 @@ from libs.cache import redis_client
import json
from moment.views.send_email import send_email_tome
import datetime
from moment.views.process_time import get_vest_userid_and_comment
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'],
answer_id=card_info['card_id'],
content=card_info['comment_content']).unwrap()
else:
today = datetime.datetime.now()
str_today = str(today.year) + str(today.month) + str(today.day)
......@@ -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))
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:
return True
# send_email_tome(str(redis_data) + str(card_info))
else:
print("answer")
# rpc_invoker = get_rpc_invoker()
# rpc_invoker['qa/irrigation/create_answer_reply'](user_id=card_info['current_user_id'],
# answer_id=card_info['card_id'],
# content=card_info['comment_content']).unwrap()
rpc_invoker = get_rpc_invoker()
rpc_invoker['qa/irrigation/create_answer_reply'](user_id=card_info['current_user_id'],
answer_id=card_info['card_id'],
content=card_info['comment_content']).unwrap()
return True
except:
logging_exception()
......
......@@ -320,10 +320,10 @@ def get_vest_userid_and_comment(need_comment_num=0, tag_names=[], card_id=0):
if all_comment_list:
content = random.sample(all_comment_list, need_comment_num)
else:
content = None
content = []
else:
content = None
content = []
return content
except:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment