Commit 90ff242b authored by lixiaofang's avatar lixiaofang

新标签

parent c39194f3
......@@ -50,6 +50,7 @@ def auto_comment_user(card_info, after_day=False):
content_level = card_info["content_level"]
card_info["action_type"] = "comment"
tag_names = card_info['tag_names']
tagv3_names = card_info['tagv3_names']
# 当满足这些条件的时候 代表已经完成了下发的所有的时间或者还没有下发过时间 需要给予新的时间
if ("all_follow_id" in card_info and "all_push_time" in card_info and len(
......@@ -71,7 +72,7 @@ def auto_comment_user(card_info, after_day=False):
if len(get_time) > 0 and time_region != 3:
###拿到下发时间后根据下发的时间个数去拿对应个数的马甲账号
all_content = get_vest_userid_and_comment(need_comment_num=len(get_time),
tag_names=tag_names )
tag_names=tag_names, tagv3_names=tagv3_names)
userids = get_vest_userid(need_comment_num=len(get_time))
for i in range(0, len(userids)):
......
......@@ -97,7 +97,8 @@ def comment(card_info):
###判断一下如果评论为空就重新拿一个
if not card_info['comment_content']:
comment = get_vest_userid_and_comment(need_comment_num=1, tag_names=card_info['tag_names'])[0]
comment = get_vest_userid_and_comment(need_comment_num=1, tag_names=card_info['tag_names'],
tagv3_names=card_info['tagv3_names'])[0]
card_info['comment_content'] = comment
##在这里加一个判断 如果当前的评论的user_id和评论内容已经在这个评论下了就不再下发给同一个回答ID
......
......@@ -13,7 +13,8 @@ from libs.error import logging_exception
@bind('vest/moment/vest_irrigation')
def vest_irrigation(card_id=0, card_type=None, card_user_id=None, create_time="", content_level=0, tag_names=[]):
def vest_irrigation(card_id=0, card_type=None, card_user_id=None, create_time="", content_level=0, tag_names=[],
tagv3_names=[]):
"""
在这里把后端传的数据存进卡夫卡 日记和帖子只需要发评论不需要点赞和关注
:param card_id:
......@@ -47,7 +48,8 @@ def vest_irrigation(card_id=0, card_type=None, card_user_id=None, create_time=""
"tag_names": tag_names,
"type": "get_write_answer_userinfo",
"current_push_time": create_time,
'action_type': 'comment'
'action_type': 'comment',
"tagv3_names": tagv3_names
}
producer.send(topic, json.dumps(comment_msg_dict).encode())
......@@ -63,7 +65,8 @@ def vest_irrigation(card_id=0, card_type=None, card_user_id=None, create_time=""
"type": "get_write_answer_userinfo",
"current_push_time": create_time,
'action_type': 'follow',
'card_user_id': card_user_id
'card_user_id': card_user_id,
"tagv3_names": tagv3_names
}
producer.send(topic, json.dumps(follow_msg_dict).encode())
......@@ -77,7 +80,8 @@ def vest_irrigation(card_id=0, card_type=None, card_user_id=None, create_time=""
"tag_names": tag_names,
"type": "get_write_answer_userinfo",
"current_push_time": create_time,
'action_type': 'click'
'action_type': 'click',
"tagv3_names": tagv3_names
}
producer.send(topic, json.dumps(click_msg_dict).encode())
......
......@@ -303,8 +303,13 @@ def get_vest_userid(need_comment_num=0):
return 12345
def get_vest_userid_and_comment(need_comment_num=0, tag_names=[]):
def get_vest_userid_and_comment(need_comment_num=0, tag_names=[], tagv3_names=[]):
try:
content = []
if tagv3_names:
content = by_tagv3_get_comment(need_comment_num=need_comment_num, tagv3_names=tagv3_names)
else:
if need_comment_num:
all_comment_list = []
content = []
......@@ -344,6 +349,31 @@ def get_vest_userid_and_comment(need_comment_num=0, tag_names=[]):
content = random.sample(all_comment_list, need_comment_num)
zhengxing_cursor.close()
return content
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return []
def by_tagv3_get_comment(need_comment_num=0, tagv3_names=[]):
try:
content = []
if need_comment_num:
all_comment_list = []
content = []
redis_key = "vest_kyc_tag_content_data_tagv3"
group_keys = "get_group_comment_by_tag:group_id"
for item in tagv3_names:
##如果自带的标签有kyc的话走kyc的标签
service_closure_tags = redis_client.hget(redis_key, str(item))
if service_closure_tags:
closure_tags = json.loads(str(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)
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