Commit 34e31a72 authored by lixiaofang's avatar lixiaofang

判断等级

parent d36963cf
......@@ -62,6 +62,7 @@ def auto_comment_user(card_info, after_day=False):
if card_info['type'] == "get_write_answer_userinfo":
repeat_time = 0
card_info['have_comment_number'] = 0
get_time, time_region = get_content_time_by_create_time(create_time, content_level,
action_type="comment",
after_day=after_day,
......
......@@ -17,6 +17,12 @@ from bs4 import BeautifulSoup
logger = logging.getLogger(__name__)
producer = KafkaProducer(bootstrap_servers=settings.KAFKA_BROKER_LIST)
db_zhengxing_eagle = pymysql.connect(host=settings.HOST, port=settings.PORT, user=settings.USER,
password=settings.PASSWORD,
db=settings.NAME)
zhengxing_cursor = db_zhengxing_eagle.cursor()
def strTimeProp(start, end, prop, frmt):
stime = time.mktime(time.strptime(start, frmt))
......@@ -147,7 +153,9 @@ def get_ten_last_days_random_time(num_days=None, frmt='%Y-%m-%d %H:%M:%S', conte
def get_content_time_by_create_time(create_time="", content_level=0, action_type=None, after_day=False, card_info=None,
repeat_time=0):
try:
###在这个地方需要重新判断一下星级
# content_level = get_current_card_content_level(card_info)
##
card_info['type'] = 'have_get_push_time'
card_info['have_comment_number'] = 0
now = datetime.datetime.now()
......@@ -333,3 +341,29 @@ def judge_offset_partition_have_consum(offset=0, partition=0):
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return False
def get_current_card_content_level(card_info=[]):
try:
# 先根据card_id回去内容提取关键字
sql = 'select content from api_answer where id = %s ' % (card_info['card_id'])
# zhengxing_cursor.execute(sql)
# data = list(zhengxing_cursor.fetchall())
# logging.info("get data:%s" % data)
# zhengxing_cursor.close()
# if len(data) > 0:
# soup = BeautifulSoup(data[0][0], 'html.parser')
# contents = soup.text
#
# ck = GetContentKeyWords()
# keywords = ck.get_keywords(contents, len(ck.tag_list))
# if keywords:
# tag_names.append(keywords)
#
# return tag_names
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return []
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