Commit 21b9cfbc authored by 李小芳's avatar 李小芳

Merge branch 'judge_status' into 'master'

Judge status

See merge request !6
parents 5a546c5f 1c526821
...@@ -9,10 +9,6 @@ from moment.views.send_email import send_email_tome ...@@ -9,10 +9,6 @@ from moment.views.send_email import send_email_tome
def click(card_info): def click(card_info):
try: try:
rpc_invoker = get_rpc_invoker()
rpc_invoker['qa/irrigation/create_answer_vote'](user_id=card_info['current_user_id'],
answer_id=card_info['card_id']).unwrap()
key = "auto_vest_one_user_action:" + str(card_info['card_id']) key = "auto_vest_one_user_action:" + str(card_info['card_id'])
redis_data = redis_client.get(key) redis_data = redis_client.get(key)
if redis_data: if redis_data:
...@@ -24,13 +20,16 @@ def click(card_info): ...@@ -24,13 +20,16 @@ def click(card_info):
redis_data = {"click": 1, "follow": 0, "comment": 0} redis_data = {"click": 1, "follow": 0, "comment": 0}
redis_client.set(key, json.dumps(redis_data)) redis_client.set(key, json.dumps(redis_data))
redis_client.expire(key, time=24 * 60 * 60) redis_client.expire(key, time=24 * 60 * 60)
logging.info("get action:click,card_id:%s,redis_data:%s" % (card_info['id'], redis_data))
logging.info("get redis_data:%s" % redis_data) click_num = redis_data["click"]
if click_num > 10:
values = list(redis_data.values())
s = [True for i in values if i > 10]
if len(s) > 0:
send_email_tome(str(redis_data) + str(card_info)) 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'],
answer_id=card_info['card_id']).unwrap()
# values = list(redis_data.values())
# s = [True for i in values if i > 10]
return True return True
except: except:
......
...@@ -9,11 +9,6 @@ from moment.views.send_email import send_email_tome ...@@ -9,11 +9,6 @@ from moment.views.send_email import send_email_tome
def comment(card_info): def comment(card_info):
try: try:
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()
####
key = "auto_vest_one_user_action:" + str(card_info['card_id']) key = "auto_vest_one_user_action:" + str(card_info['card_id'])
redis_data = redis_client.get(key) redis_data = redis_client.get(key)
if redis_data: if redis_data:
...@@ -25,14 +20,16 @@ def comment(card_info): ...@@ -25,14 +20,16 @@ def comment(card_info):
redis_data = {"click": 0, "follow": 0, "comment": 1} redis_data = {"click": 0, "follow": 0, "comment": 1}
redis_client.set(key, json.dumps(redis_data)) redis_client.set(key, json.dumps(redis_data))
redis_client.expire(key, time=24 * 60 * 60) redis_client.expire(key, time=24 * 60 * 60)
logging.info("get action:comment,card_id:%s,redis_data:%s" % (card_info['id'], redis_data))
logging.info("get redis_data:%s" % redis_data) comment_num = redis_data["comment"]
####在这里做判断 一天不能超过20个 如果超过二十个不下发 不超过二十个下发对应的灌水功能
values = list(redis_data.values()) if comment_num > 20:
s = [True for i in values if i > 10]
if len(s) > 0:
send_email_tome(str(redis_data) + str(card_info)) 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'],
answer_id=card_info['card_id'],
content=card_info['comment_content']).unwrap()
return True return True
except: except:
logging_exception() logging_exception()
......
...@@ -9,10 +9,6 @@ from moment.views.send_email import send_email_tome ...@@ -9,10 +9,6 @@ from moment.views.send_email import send_email_tome
def follow(card_info): def follow(card_info):
try: try:
rpc_invoker = get_rpc_invoker()
rpc_invoker['api/irrigation/user_add_follow'](follow_user_id=card_info['current_user_id'],
followed_user_id=card_info['card_user_id']).unwrap()
key = "auto_vest_one_user_action:" + str(card_info['card_id']) key = "auto_vest_one_user_action:" + str(card_info['card_id'])
redis_data = redis_client.get(key) redis_data = redis_client.get(key)
if redis_data: if redis_data:
...@@ -24,12 +20,18 @@ def follow(card_info): ...@@ -24,12 +20,18 @@ def follow(card_info):
redis_data = {"click": 0, "follow": 1, "comment": 0} redis_data = {"click": 0, "follow": 1, "comment": 0}
redis_client.set(key, json.dumps(redis_data)) redis_client.set(key, json.dumps(redis_data))
redis_client.expire(key, time=24 * 60 * 60) redis_client.expire(key, time=24 * 60 * 60)
logging.info("get action:follow,card_id:%s,redis_data:%s" % (card_info['id'], redis_data))
follow_num = redis_data["follow"]
logging.info("get redis_data:%s" % redis_data) if follow_num > 10:
values = list(redis_data.values())
s = [True for i in values if i > 10]
if len(s) > 0:
send_email_tome(str(redis_data) + str(card_info)) 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'],
followed_user_id=card_info['card_user_id']).unwrap()
# values = list(redis_data.values())
# s = [True for i in values if i > 10]
return True return True
except: 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