Commit 8744fcfb authored by lixiaofang's avatar lixiaofang

add

parent dcb2458f
This diff is collapsed.
......@@ -21,7 +21,6 @@ def get_topic_id(numtime1, numtime2):
)
data = cursor.fetchall()
topic_id = list(data)
logging.info("Database version : %s " % topic_id)
topic_id_list = []
if topic_id:
for i in topic_id:
......@@ -63,8 +62,6 @@ if __name__ == "__main__":
else:
dicts[i[1]].append(i[0])
logging.info("get dicts:%s" % dicts)
for key, value in dicts.items():
rand_num = random.randint(0, len(value) - 1)
......@@ -73,8 +70,6 @@ if __name__ == "__main__":
comment = get_comment()
logging.info("get comment:%s" % comment)
for i in range(1):
time.sleep(random.randint(10, 20))
......
......@@ -10,22 +10,22 @@ from auto_request import login, time_convs, follow, get_user_id
from auto_request import host, user, port, db, passwd
def get_topic_new_user(numtime):
def get_topic_new_user(numtime1, numtime2):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=port)
cursor = pc.cursor()
cursor.execute(
"SELECT distinct(user_id) FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%' " % numtime)
"SELECT distinct(user_id) FROM topic WHERE is_online=1 and create_time > '%s' " % numtime1)
topic_data = cursor.fetchall()
cursor.execute(
"SELECT distinct(user_id) FROM group_user_role WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
"SELECT distinct(user_id) FROM group_user_role WHERE create_time > '%s'" % numtime1)
new_user_data = cursor.fetchall()
topic_data = list(topic_data)
new_user_data = list(new_user_data)
topic_id_list = []
if topic_data :
if topic_data:
for i in topic_data:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0")
......@@ -54,26 +54,24 @@ def get_topic_new_user(numtime):
if __name__ == "__main__":
try:
numtime = time_convs(0)
numtime1, numtime2 = time_convs(1, 1)
user_id = get_topic_new_user(numtime)
user_id = get_topic_new_user(numtime1)
follow_num = random.randint(1, 2)
for i in range(follow_num):
if user_id:
for j in user_id and user_id:
for j in user_id:
id = int(j[0])
id = int(j[0])
time.sleep(random.randint(10, 30))
time.sleep(random.randint(10, 30))
cookies = login()
cookies = login()
if cookies is not None:
follow(cookies, id)
if cookies is not None:
follow(cookies, id)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -14,6 +14,16 @@
#
# print(yes_time_str)
# print(yes_time_str2)
import random
rand_num = random.randint(0,2)
print(rand_num)
\ No newline at end of file
# import random
# rand_num = random.randint(0,2)
# print(rand_n
#
# um)
import datetime
now = datetime.datetime.now()
yes_time = now - datetime.timedelta(days=1)
yes_time_str = yes_time.strftime('%Y-%m-%d')
yes_time_str = yes_time_str + ' 23:59:59.000000'
print(yes_time_str)
\ No newline at end of file
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