Commit bbfeae53 authored by lixiaofang's avatar lixiaofang

新增类型

parent 75e57c50
...@@ -34,9 +34,10 @@ def click(card_info): ...@@ -34,9 +34,10 @@ def click(card_info):
return True return True
# send_email_tome(str(redis_data) + str(card_info)) # send_email_tome(str(redis_data) + str(card_info))
else: else:
rpc_invoker = get_rpc_invoker() print("goodgoodgood")
rpc_invoker['qa/irrigation/create_answer_vote'](user_id=card_info['current_user_id'], # rpc_invoker = get_rpc_invoker()
answer_id=card_info['card_id']).unwrap() # rpc_invoker['qa/irrigation/create_answer_vote'](user_id=card_info['current_user_id'],
# answer_id=card_info['card_id']).unwrap()
return True return True
except: except:
logging_exception() logging_exception()
......
...@@ -40,10 +40,12 @@ def comment(card_info): ...@@ -40,10 +40,12 @@ def comment(card_info):
return True return True
# send_email_tome(str(redis_data) + str(card_info)) # send_email_tome(str(redis_data) + str(card_info))
else: else:
rpc_invoker = get_rpc_invoker() print("tractate")
rpc_invoker['qa/irrigation/create_answer_reply'](user_id=card_info['current_user_id'],
answer_id=card_info['card_id'], # rpc_invoker = get_rpc_invoker()
content=card_info['comment_content']).unwrap() # 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()
elif card_info['card_status'] == 'diary': elif card_info['card_status'] == 'diary':
today = datetime.datetime.now() today = datetime.datetime.now()
...@@ -69,10 +71,12 @@ def comment(card_info): ...@@ -69,10 +71,12 @@ def comment(card_info):
return True return True
# send_email_tome(str(redis_data) + str(card_info)) # send_email_tome(str(redis_data) + str(card_info))
else: else:
rpc_invoker = get_rpc_invoker() print("diary")
rpc_invoker['qa/irrigation/create_answer_reply'](user_id=card_info['current_user_id'],
answer_id=card_info['card_id'], # rpc_invoker = get_rpc_invoker()
content=card_info['comment_content']).unwrap() # 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: else:
today = datetime.datetime.now() today = datetime.datetime.now()
...@@ -99,10 +103,12 @@ def comment(card_info): ...@@ -99,10 +103,12 @@ def comment(card_info):
return True return True
# send_email_tome(str(redis_data) + str(card_info)) # send_email_tome(str(redis_data) + str(card_info))
else: else:
rpc_invoker = get_rpc_invoker() print("answer")
rpc_invoker['qa/irrigation/create_answer_reply'](user_id=card_info['current_user_id'],
answer_id=card_info['card_id'], # rpc_invoker = get_rpc_invoker()
content=card_info['comment_content']).unwrap() # 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()
......
...@@ -31,9 +31,11 @@ def follow(card_info): ...@@ -31,9 +31,11 @@ def follow(card_info):
return True return True
# send_email_tome(str(redis_data) + str(card_info)) # send_email_tome(str(redis_data) + str(card_info))
else: else:
rpc_invoker = get_rpc_invoker() print("goodgoodgood")
rpc_invoker['api/irrigation/user_add_follow'](follow_user_id=card_info['current_user_id'],
followed_user_id=card_info['card_user_id']).unwrap() # 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()
return True return True
except: except:
......
...@@ -42,12 +42,14 @@ def kafka_consum(topic_name=None): ...@@ -42,12 +42,14 @@ def kafka_consum(topic_name=None):
if card_info['card_type'] == "auto_vest": if card_info['card_type'] == "auto_vest":
###在这里去判断一下当前的partition和offset是否已经消费过了 如果已经消费了需要直接去掉数据 ###在这里去判断一下当前的partition和offset是否已经消费过了 如果已经消费了需要直接去掉数据
bol_consum = judge_offset_partition_have_consum(offset=msg.offset, partition=msg.partition) bol_consum = judge_offset_partition_have_consum(offset=msg.offset, partition=msg.partition)
if bol_consum: if bol_consum:
logging.info("消费到新数据了[%s,%s,%s,%s],get card_info:%s" % ( logging.info("消费到新数据了[%s,%s,%s,%s],get card_info:%s" % (
str(msg.topic), str(msg.partition), str(msg.offset), str(msg.key), card_info)) str(msg.topic), str(msg.partition), str(msg.offset), str(msg.key), card_info))
redis_client.hset(redis_topic_partition_name, msg.partition, msg.offset) redis_client.hset(redis_topic_partition_name, msg.partition, msg.offset)
# 代表当天数据 # 如果没有代表是之前的老的数据
if 'card_status' not in card_info:
card_info['card_status'] = 'answer'
current_push_time = card_info['current_push_time'] current_push_time = card_info['current_push_time']
create_time = card_info['create_time'] create_time = card_info['create_time']
nowtime = datetime.datetime.now() nowtime = datetime.datetime.now()
......
...@@ -370,7 +370,7 @@ def get_current_card_content_level(card_info=[]): ...@@ -370,7 +370,7 @@ def get_current_card_content_level(card_info=[]):
sql = 'select content_level from api_diary where id = %s ' % (card_info['card_id']) sql = 'select content_level from api_diary where id = %s ' % (card_info['card_id'])
zhengxing_cursor.execute(sql) zhengxing_cursor.execute(sql)
data = list(zhengxing_cursor.fetchall()) data = list(zhengxing_cursor.fetchall())
logging.info("get_content_level_card_info:%s" % card_info)
if len(data) > 0: if len(data) > 0:
return int(data[0][0]) return int(data[0][0])
......
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