Commit 3be4c09b authored by lixiaofang's avatar lixiaofang

add

parent ea26371e
This diff is collapsed.
......@@ -15,31 +15,31 @@ def get_commnet_id(numtime):
cursor = pc.cursor()
cursor.execute(
"SELECT user_id FROM reply WHERE create_time LIKE '%%%%%s%%%%' " % numtime)
"SELECT user_id FROM reply WHERE create_time > '%s' " % numtime)
data_comment = cursor.fetchall()
cursor.execute(
"SELECT t.user_id from topic t left join reply r on r.topic_id = t.id WHERE r.create_time LIKE '%%%%%s%%%%'" % numtime)
"SELECT t.user_id from topic t left join reply r on r.topic_id = t.id WHERE r.create_time > '%s'" % numtime)
data_reply_topic = cursor.fetchall()
cursor.execute(
"SELECT r.user_id from reply r left join reply p on r.replied_id = p.replied_id WHERE p.create_time LIKE '%%%%%s%%%%'" % numtime)
"SELECT r.user_id from reply r left join reply p on r.replied_id = p.replied_id WHERE p.create_time > '%s'" % numtime)
data_reply_reply = cursor.fetchall()
cursor.execute(
"SELECT user_id FROM group_user_role WHERE create_time LIKE '%%%%%s%%%%' " % numtime)
"SELECT user_id FROM group_user_role WHERE create_time > '%s' " % numtime)
data_group_follow = cursor.fetchall()
cursor.execute(
"select user_id from account_user WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
"select user_id from account_user WHERE create_time > '%s'" % numtime)
data_new_user = cursor.fetchall()
......@@ -101,9 +101,9 @@ if __name__ == "__main__":
try:
numtime = time_convs(1)
numtime1, numtime2 = time_convs(1, 2)
user_id = get_commnet_id(numtime)
user_id = get_commnet_id(numtime1)
for j in user_id and user_id:
......
......@@ -15,7 +15,7 @@ def get_data(numtime):
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute(
"select distinct(user_id) from pv_maidian where page_name ='home' and partiton_date like '%%%%%s%%%%'" % numtime)
"select distinct(user_id) from pv_maidian where page_name ='home' and partiton_date > '%s'" % numtime)
data = cursor.fetchall()
user_id = list(data)
topic_id_list = []
......@@ -37,9 +37,9 @@ def get_data(numtime):
if __name__ == "__main__":
try:
numtime = time_convs(1)
numtime1, numtime2 = time_convs(1, 2)
user_id = get_data(numtime)
user_id = get_data(numtime1)
urge_num = random.randint(0, 1)
for j in range(urge_num):
for i in user_id and user_id:
......
......@@ -15,7 +15,7 @@ def get_star_user_id(numtime):
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute(
"SELECT user_id,id FROM topic WHERE is_online=1 and (content_level =4 or content_level =5) and create_time LIKE '%%%%%s%%%%' " % numtime)
"SELECT user_id,id FROM topic WHERE is_online=1 and (content_level =4 or content_level =5) and create_time > '%s' " % numtime)
data = cursor.fetchall()
user_id_list = list(data)
logging.info("Database version : %s " % user_id_list)
......@@ -43,9 +43,9 @@ if __name__ == "__main__":
for i in time_list:
numtime = time_conv(i)
numtime1, numtime2 = time_conv(i + 1, i - 1)
user_topic_id = get_star_user_id(numtime)
user_topic_id = get_star_user_id(numtime1)
if user_topic_id:
......@@ -64,9 +64,7 @@ if __name__ == "__main__":
if cookies is not None:
click(cookies, id)
time.sleep(300)
user_id = get_star_user_id(numtime)
user_id = get_star_user_id(numtime1)
if user_id:
......@@ -83,7 +81,5 @@ if __name__ == "__main__":
if cookies is not None:
follow(cookies, id)
time.sleep(300)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -15,7 +15,7 @@ def get_star_useid(numtime):
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute(
"SELECT distinct(user_id) FROM topic WHERE is_online=1 and (content_level =4 or content_level =5) and create_time LIKE '%%%%%s%%%%'" % numtime)
"SELECT distinct(user_id) FROM topic WHERE is_online=1 and (content_level =4 or content_level =5) and create_time > '%s'" % numtime)
data = cursor.fetchall()
user_id = list(data)
topic_id_list = []
......@@ -42,9 +42,9 @@ if __name__ == "__main__":
for i in time_list:
numtime = time_conv(i)
numtime1, numtime2 = time_conv(i + 1, i - 1)
user_id = get_star_useid(numtime)
user_id = get_star_useid(numtime1)
for j in user_id and user_id:
......
......@@ -16,7 +16,7 @@ def get_data(numtime):
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
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'" % numtime)
data = cursor.fetchall()
user_id = list(data)
......@@ -46,9 +46,9 @@ if __name__ == "__main__":
for i in time_list:
numtime = time_conv(i)
numtime1,numtime2 = time_conv(i+1,i-1)
user_id = get_data(numtime)
user_id = get_data(numtime1)
urge_num = random.randint(0, 2)
......@@ -64,10 +64,5 @@ if __name__ == "__main__":
if cookies is not None:
Urge(cookies, id)
sleep_time = random.randint(300, 540)
timer = threading.Timer(1, urge_user) # 首次启动
timer.start()
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
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