Commit f6de495a authored by lixiaofang's avatar lixiaofang

修改

parent 32f9ecdd
This diff is collapsed.
...@@ -16,7 +16,7 @@ def get_data(numtime, numtime2): ...@@ -16,7 +16,7 @@ def get_data(numtime, numtime2):
logging.info("get numtime2:%s" % numtime2) logging.info("get numtime2:%s" % numtime2)
cursor.execute( cursor.execute(
"SELECT user_id,id FROM topic WHERE is_online=1 and (create_time >= '%s' and create_time <= '%s')" % ( "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() data = cursor.fetchall()
topic_id = list(data) topic_id = list(data)
topic_id_list = [] topic_id_list = []
...@@ -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,14 +65,15 @@ if __name__ == "__main__": ...@@ -65,14 +65,15 @@ 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:
rand_num = random.randint(1, 3) for id in topic_id:
for i in range(rand_num): rand_num = random.randint(1, 3)
num = random.randint(0, len(user_list) - 1) for i in range(rand_num):
user_id = user_list[num] num = random.randint(0, len(user_list) - 1)
if user_id != id[1]: user_id = user_list[num]
comment_list = get_offline_comment() if user_id != id[1]:
comment = comment_list[i] comment_list = get_offline_comment()
reply(id[0], comment, user_id) comment = comment_list[i]
reply(id[0], comment, user_id)
except: except:
logging.error("catch exception,main :%s" % traceback.format_exc()) logging.error("catch exception,main :%s" % traceback.format_exc())
...@@ -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