Commit 0293e077 authored by lixiaofang's avatar lixiaofang

add

parent faa91bdf
......@@ -43,7 +43,7 @@ def write_to_es(es_type, pk_list, use_batch_query_set=False):
# es=ESPerform.get_cli()
# )
auto_click(pk_list)
auto_reply(pk_list)
# auto_reply(pk_list)
except:
......@@ -116,12 +116,12 @@ def auto_click(pk_list):
yes_time_str = now.strftime('%Y-%m-%d')
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
topic_id_list=[]
topic_id_list = []
if len(pk_list) > 0:
cursor.execute(
"SELECT id,user_id FROM topic WHERE id in " + str(
"SELECT id,user_id FROM topic WHERE id in " + str( # and create_time LIKE '%%%%%s%%%%'% yes_time_str
tuple(
pk_list)) + " and user_id in (select user_id from user_extra where is_shadow = 0) and create_time LIKE '%%%%%s%%%%' " % yes_time_str)
pk_list)) + " and user_id in (select user_id from user_extra where is_shadow = 0)")
data = cursor.fetchall()
topic_id_list = list(data)
logging.info("Database version : %s " % topic_id_list)
......@@ -172,18 +172,21 @@ def auto_reply(pk_list):
yes_time_str = now.strftime('%Y-%m-%d')
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
topic_id_list =[]
if len(pk_list) > 0:
cursor.execute(
"SELECT id,user_id FROM topic WHERE id in " + str(
tuple(
topic_id_list = []
try:
if len(pk_list) > 0:
cursor.execute(
"SELECT id,user_id FROM topic WHERE id in " + str(tuple(
pk_list)) + " and user_id in (select user_id from user_extra where is_shadow = 0) and create_time LIKE '%%%%%s%%%%' " % (
yes_time_str))
data = cursor.fetchall()
topic_id_list = list(data)
logging.info("Database version : %s " % topic_id_list)
pc.close()
yes_time_str))
data = cursor.fetchall()
topic_id_list = list(data)
logging.info("Database version : %s " % topic_id_list)
pc.close()
except:
pass
if topic_id_list:
try:
def fun_comment():
......
......@@ -11,7 +11,7 @@ class CeleryTaskRouter(object):
'injection.data_sync.tasks.write_to_es',
],
# "majia-alpha": [
# 'majia.tasks.auto_majia_effect',
# 'injection.data_sync.tasks.auto_majia_effect',
# ],
}
......
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