Commit b2b82d2e authored by lixiaofang's avatar lixiaofang

add

parent 7fb0a657
......@@ -43,7 +43,7 @@ def write_to_es(es_type, pk_list, use_batch_query_set=False):
# es=ESPerform.get_cli()
# )
if es_type == 'topic':
# if es_type == 'topic':
auto_click(pk_list)
auto_reply(pk_list)
......@@ -127,14 +127,20 @@ def auto_click(pk_list):
cursor = pc.cursor()
topic_id_list = []
if len(pk_list) > 0:
if len(pk_list) == 1:
cursor.execute(
"SELECT id FROM topic WHERE id = " + str(
pk_list[0]) + " and user_id in (select user_id from user_extra where is_shadow = 1)")
else:
cursor.execute(
"SELECT 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)")
tuple(pk_list)) + " and user_id in (select user_id from user_extra where is_shadow = 1)")
data = cursor.fetchall()
topic_id_list = list(data)
logging.info("Database version : %s " % topic_id_list)
pc.close()
if topic_id_list:
try:
def fun_timer():
......@@ -185,10 +191,15 @@ def auto_reply(pk_list):
topic_id_list = []
try:
if len(pk_list) > 0:
if len(pk_list) == 1:
cursor.execute(
"SELECT id FROM topic WHERE id = " + str(tuple( # and create_time LIKE '%%%%%s%%%%'
pk_list)) + " and user_id in (select user_id from user_extra where is_shadow = 0) ")
else:
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))
"SELECT id FROM topic WHERE id in " + str(tuple( # and create_time LIKE '%%%%%s%%%%'
pk_list)) + " and user_id in (select user_id from user_extra where is_shadow = 0) ")
data = cursor.fetchall()
topic_id_list = list(data)
......@@ -204,7 +215,7 @@ def auto_reply(pk_list):
if cookies:
comment_content = get_comments()
comment = comment_content[0]
reply(cookies, topic_id_list[0], comment)
reply(cookies, topic_id_list[0][0], comment)
global timer
global exec_count
......
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