Commit bc1eb0e0 authored by lixiaofang's avatar lixiaofang

add

parent a5826b8a
This diff is collapsed.
......@@ -66,12 +66,11 @@ if __name__ == "__main__":
for i in range(urge_num):
time.sleep(random.randint(10, 50))
time.sleep(random.randint(1, 10))
cook = login()
if cook is not None:
click(cook, rand_id)
time.sleep(100)
......
......@@ -9,13 +9,14 @@ from auto_request import login, click, time_convs
from auto_request import host, user, db, passwd
def get_data(numtime,numtime2):
def get_data(numtime, numtime2):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute(
"SELECT user_id , id FROM topic WHERE is_online=1 and create_time > '%%%%%s%%%%' and create_time < '%%%%%s%%%%' " % (numtime,numtime2))
"SELECT user_id , id FROM topic WHERE is_online=1 and create_time > '%s' and create_time < '%s' " % (
numtime, numtime2))
data = cursor.fetchall()
topic_id = list(data)
topic_id_list = []
......@@ -32,7 +33,7 @@ def get_data(numtime,numtime2):
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return []
return []
if __name__ == "__main__":
......@@ -43,9 +44,9 @@ if __name__ == "__main__":
for i in time_list:
numtime = time_convs(7 + 3 * i)
numtime1, numtime2 = time_convs(7 + 3 * i + 1, 7 + 3 * i - 1)
user_id = get_data(numtime)
user_id = get_data(numtime1, numtime2)
dict = {}
......@@ -77,8 +78,5 @@ if __name__ == "__main__":
if cook is not None:
click(cook, rand_id)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -11,12 +11,13 @@ from auto_request import login, time_convs, reply, get_comment
from auto_request import host, user, db, passwd
def get_topic_id(numtime):
def get_topic_id(numtime1, numtime2):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute(
"SELECT id,user_id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%' " % numtime
"SELECT id,user_id FROM topic WHERE is_online=1 and create_time > '%s' and create_time < '%s' " % (
numtime1, numtime2)
)
data = cursor.fetchall()
topic_id = list(data)
......@@ -43,11 +44,11 @@ if __name__ == "__main__":
try:
time_list = [1]
time_list = [1, 2, 3, 4, 5, 6, 7]
for i in time_list:
numtime = time_convs(i)
numtime = time_convs(i + 1, i - 1)
topic_id = get_topic_id(numtime)
......
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