Commit b03ad5b5 authored by lixiaofang's avatar lixiaofang

add

parent ba9eca6c
...@@ -13,19 +13,17 @@ from get_session import get_comments, get_cookies, click, time_conv, login, repl ...@@ -13,19 +13,17 @@ from get_session import get_comments, get_cookies, click, time_conv, login, repl
@shared_task @shared_task
def auto_click(id): def auto_click(pk_list):
try: try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306) pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor() cursor = pc.cursor()
cursor.execute( cursor.execute(
"SELECT id,user_id FROM topic WHERE id = " + str( "SELECT id,user_id FROM topic WHERE id in " + (
id) + " and user_id in (select user_id from user_extra where is_shadow = 0)") pk_list) + " and user_id in (select user_id from user_extra where is_shadow = 0)")
data = cursor.fetchall() data = cursor.fetchall()
topic_id_list = list(data) topic_id_list = list(data)
logging.info("Database version : %s " % topic_id_list) logging.info("Database version : %s " % topic_id_list)
pc.close() pc.close()
topic_id_list = 919337
exec_count = 0 exec_count = 0
if topic_id_list: if topic_id_list:
...@@ -50,8 +48,6 @@ def auto_click(id): ...@@ -50,8 +48,6 @@ def auto_click(id):
timer = threading.Timer(sleep_time, fun_timer) timer = threading.Timer(sleep_time, fun_timer)
timer.start() timer.start()
sleep_time = random.randint(300, 540) sleep_time = random.randint(300, 540)
timer = threading.Timer(10, fun_comment) # 首次启动 timer = threading.Timer(10, fun_comment) # 首次启动
timer.start() timer.start()
...@@ -67,13 +63,13 @@ def auto_click(id): ...@@ -67,13 +63,13 @@ def auto_click(id):
@shared_task @shared_task
def auto_reply(id): def auto_reply(pk_list):
try: try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306) pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor() cursor = pc.cursor()
cursor.execute( cursor.execute(
"SELECT id,user_id FROM topic WHERE id = " + str( "SELECT id,user_id FROM topic WHERE id in " + (
id) + " and user_id in (select user_id from user_extra where is_shadow = 0)") pk_list) + " and user_id in (select user_id from user_extra where is_shadow = 0)")
data = cursor.fetchall() data = cursor.fetchall()
topic_id_list = list(data) topic_id_list = list(data)
logging.info("Database version : %s " % topic_id_list) logging.info("Database version : %s " % topic_id_list)
...@@ -113,4 +109,3 @@ def auto_reply(id): ...@@ -113,4 +109,3 @@ def auto_reply(id):
except: except:
logging.error("catch exception,main:%s" % traceback.format_exc()) logging.error("catch exception,main:%s" % traceback.format_exc())
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