Commit 6e5b6d60 authored by lixiaofang's avatar lixiaofang

add

parent c4e8c348
......@@ -17,16 +17,17 @@ def get_data(numtime):
data = cursor.fetchall()
topic_id = list(data)
topic_id_list = []
for i in topic_id:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close()
return topic_id_list
if topic_id:
for i in topic_id:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close()
return topic_id_list
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
......@@ -46,31 +47,33 @@ if __name__ == "__main__":
dicts = {}
for i in user_id:
if user_id:
for i in user_id:
if i[0] not in dicts.keys():
dicts.setdefault(i[0], [])
dicts[i[0]].append(i[1])
if i[0] not in dicts.keys():
dicts.setdefault(i[0], [])
dicts[i[0]].append(i[1])
else:
dicts[i[0]].append(i[1])
else:
dicts[i[0]].append(i[1])
for key, value in dicts.items():
for key, value in dicts.items():
rand_num = random.randint(0, len(value) - 1)
rand_num = random.randint(0, len(value) - 1)
rand_id = value[rand_num]
rand_id = value[rand_num]
urge_num = random.randint(0, 1)
urge_num = random.randint(0, 1)
for i in range(urge_num):
for i in range(urge_num):
time.sleep(random.randint(1, 10))
time.sleep(random.randint(1, 10))
cook = login()
cook = login()
if cook is not None:
click(cook, rand_id)
if cook is not None:
click(cook, rand_id)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -18,6 +18,7 @@ def get_star_user_id(numtime):
"SELECT user_id,id FROM topic WHERE is_online=1 and (content_level =4 or content_level =5) and create_time LIKE '%%%%%s%%%%' " % numtime)
data = cursor.fetchall()
user_id_list = list(data)
logging.info("Database version : %s " % user_id_list)
topic_id_list = []
if user_id_list:
for i in user_id_list:
......
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