Commit f6de495a authored by lixiaofang's avatar lixiaofang

修改

parent 32f9ecdd
This diff is collapsed.
...@@ -41,11 +41,11 @@ def get_data(numtime, numtime2): ...@@ -41,11 +41,11 @@ def get_data(numtime, numtime2):
if __name__ == "__main__": if __name__ == "__main__":
try: try:
numtime, numtime2 = time_conv(27,17) numtime, numtime2 = time_conv(27, 17)
user_id = get_data(numtime, numtime2) user_id = get_data(numtime, numtime2)
dicts = {} dicts = {}
for i in user_id: for i in user_id:
rand_num = random.randint(0,1) rand_num = random.randint(0, 1)
if rand_num == 1: if rand_num == 1:
cook = login() cook = login()
if cook is not None: if cook is not None:
......
...@@ -24,7 +24,7 @@ def get_data(): ...@@ -24,7 +24,7 @@ def get_data():
print(user_id) print(user_id)
user_id_list.append(user_id[0]) user_id_list.append(user_id[0])
else: else:
paas pass
pc.close() pc.close()
return user_id_list return user_id_list
except: except:
......
This diff is collapsed.
This diff is collapsed.
...@@ -33,14 +33,14 @@ def get_data(now, noww): ...@@ -33,14 +33,14 @@ def get_data(now, noww):
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 is_online =1 and ( create_time > '%s' and create_time <= '%s' ) and (content_level = 4 or content_level = 5 or content_level = 6) " % ( "SELECT id,user_id FROM topic WHERE ( create_time > '%s' and create_time <= '%s' ) and is_online = 1 and content_level in (4,5,6) " % (
now, noww)) now, noww))
data = cursor.fetchall() data = cursor.fetchall()
topic_id = list(data) topic_id = list(data)
topic_id_list = [] topic_id_list = []
for i in topic_id: for id in topic_id:
cursor.execute( cursor.execute(
"select user_id from user_extra where user_id =" + str(i[1]) + " and is_shadow =1") "select user_id from user_extra where user_id =" + str(id[1]) + " and is_shadow =1")
data = cursor.fetchall() data = cursor.fetchall()
user_id = list(data) user_id = list(data)
if user_id: if user_id:
...@@ -65,7 +65,8 @@ if __name__ == "__main__": ...@@ -65,7 +65,8 @@ if __name__ == "__main__":
user_list.append(i) user_list.append(i)
topic_id = get_data(yes_time, now) topic_id = get_data(yes_time, now)
dicts = {} dicts = {}
for id in topic_id and topic_id: if topic_id:
for id in topic_id:
rand_num = random.randint(1, 3) rand_num = random.randint(1, 3)
for i in range(rand_num): for i in range(rand_num):
num = random.randint(0, len(user_list) - 1) num = random.randint(0, len(user_list) - 1)
......
...@@ -2,7 +2,7 @@ import requests ...@@ -2,7 +2,7 @@ import requests
import traceback import traceback
import logging import logging
login_url = "http://earth.igengmei.com/api/account/login_pwd" login_url = "http://earth.iyanzhi.com/api/account/login_pwd"
def index_first(): def index_first():
......
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