Commit f6de495a authored by lixiaofang's avatar lixiaofang

修改

parent 32f9ecdd
This diff is collapsed.
......@@ -16,7 +16,7 @@ def get_data(numtime, numtime2):
logging.info("get numtime2:%s" % numtime2)
cursor.execute(
"SELECT user_id,id FROM topic WHERE is_online=1 and (create_time >= '%s' and create_time <= '%s')" % (
numtime, numtime2))
numtime, numtime2))
data = cursor.fetchall()
topic_id = list(data)
topic_id_list = []
......@@ -41,11 +41,11 @@ def get_data(numtime, numtime2):
if __name__ == "__main__":
try:
numtime, numtime2 = time_conv(27,17)
numtime, numtime2 = time_conv(27, 17)
user_id = get_data(numtime, numtime2)
dicts = {}
for i in user_id:
rand_num = random.randint(0,1)
rand_num = random.randint(0, 1)
if rand_num == 1:
cook = login()
if cook is not None:
......
......@@ -24,7 +24,7 @@ def get_data():
print(user_id)
user_id_list.append(user_id[0])
else:
paas
pass
pc.close()
return user_id_list
except:
......
This diff is collapsed.
This diff is collapsed.
......@@ -33,14 +33,14 @@ def get_data(now, noww):
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 > '%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))
data = cursor.fetchall()
topic_id = list(data)
topic_id_list = []
for i in topic_id:
for id in topic_id:
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()
user_id = list(data)
if user_id:
......@@ -65,14 +65,15 @@ if __name__ == "__main__":
user_list.append(i)
topic_id = get_data(yes_time, now)
dicts = {}
for id in topic_id and topic_id:
rand_num = random.randint(1, 3)
for i in range(rand_num):
num = random.randint(0, len(user_list) - 1)
user_id = user_list[num]
if user_id != id[1]:
comment_list = get_offline_comment()
comment = comment_list[i]
reply(id[0], comment, user_id)
if topic_id:
for id in topic_id:
rand_num = random.randint(1, 3)
for i in range(rand_num):
num = random.randint(0, len(user_list) - 1)
user_id = user_list[num]
if user_id != id[1]:
comment_list = get_offline_comment()
comment = comment_list[i]
reply(id[0], comment, user_id)
except:
logging.error("catch exception,main :%s" % traceback.format_exc())
......@@ -2,7 +2,7 @@ import requests
import traceback
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():
......
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