Commit 6f49cab6 authored by lixiaofang's avatar lixiaofang

add

parent 5e4d6a92
This diff is collapsed.
......@@ -33,11 +33,12 @@ def get_data(numtime, numtime2):
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return []
if __name__ == "__main__":
try:
time_list = [1,2,3, 4, 5, 6, 7]
time_list = [1, 2, 3, 4, 5, 6, 7]
for i in time_list:
numtime, numtime2 = time_convs(i + 1, i - 1)
......@@ -56,7 +57,6 @@ if __name__ == "__main__":
dicts[i[0]].append(i[1])
for key, value in dicts.items():
rand_num = random.randint(0, len(value) - 1)
rand_id = value[rand_num]
......@@ -75,4 +75,4 @@ if __name__ == "__main__":
pass
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
\ No newline at end of file
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -41,7 +41,7 @@ def get_data(numtime, numtime2):
if __name__ == "__main__":
try:
numtime, numtime2 = time_conv(15, 5)
numtime, numtime2 = time_conv(5,0)
user_id = get_data(numtime, numtime2)
dicts = {}
for i in user_id:
......@@ -49,4 +49,4 @@ if __name__ == "__main__":
if cook is not None:
click(cook, i[1])
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
logging.error("catch exception,main:%s" % traceback.format_exc())
\ No newline at end of file
import time
import pymysql
import random
import traceback
from log_settings import *
import logging
from auto_request import login, click, time_conv
from auto_request import host, user, db, passwd
def get_data(numtime, numtime2):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute(
"select id from topic where content_level in (4,5,6) and create_time > '2019-05-01 00:00:00.0000' and id not in (select topic_id from reply )")
data = cursor.fetchall()
topic_id = list(data)
pc.close()
return topic_id
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
if __name__ == "__main__":
try:
numtime, numtime2 = time_conv(15, 5)
user_id = get_data(numtime, numtime2)
dicts = {}
logging.info("get user_id:%s" % user_id)
for i in user_id:
cook = login()
if cook is not None:
click(cook, i)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
import time
import pymysql
import random
import traceback
from log_settings import *
import logging
from auto_request import login, click, time_conv
from auto_request import host, user, db, passwd
def get_data(numtime, numtime2):
try:
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 (create_time >= '2019-05-01 00:00:00.000000' and create_time <= '2019-05-13 00:00:00.000000')")
data = cursor.fetchall()
topic_id = list(data)
topic_id_list = []
try:
for i in topic_id:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute("select topic_id from reply where topic_id =" + str(i[1]))
data_s = cursor.fetchall()
topic_id_s = list(data_s)
if len(topic_id_s) == 0:
try:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close()
except:
pass
return topic_id_list
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return []
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
if __name__ == "__main__":
try:
numtime, numtime2 = time_conv(15, 5)
user_id = get_data(numtime, numtime2)
dicts = {}
for i in user_id:
cook = login()
if cook is not None:
click(cook, i[1])
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -44,7 +44,7 @@ if __name__ == "__main__":
try:
logging.info("comment one")
numtime1, numtime2 = time_conv(15, 5)
numtime1, numtime2 = time_conv(5, 0)
user_id = get_data(numtime1, numtime2)
dicts = {}
if user_id:
......
import pymysql
import random
import traceback
from log_settings import *
import logging
from auto_request import login, time_conv, get_comment, reply
from auto_request import host, user, db, passwd
def get_data(numtime, numtime2):
try:
print("....")
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 (create_time >= '2019-05-09 00:00:00.000000' and create_time <= '2019-05-13 00:00:00.000000')")
data = cursor.fetchall()
topic_id = list(data)
topic_id_list = []
try:
for i in topic_id:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute("select topic_id from reply where topic_id =" + str(i[1]))
data_s = cursor.fetchall()
topic_id_s = list(data_s)
if len(topic_id_s) == 0:
try:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close()
except:
pass
return topic_id_list
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return []
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return []
if __name__ == "__main__":
try:
logging.info("comment one")
numtime1, numtime2 = time_conv(15, 5)
user_id = get_data(numtime1, numtime2)
dicts = {}
if user_id:
for i in user_id:
cook = login()
comment = get_comment()
if cook is not None:
reply(cook, i[1], comment)
else:
logging.error("catch exception,main:%s" % traceback.format_exc())
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
import time
import pymysql
import random
import traceback
from log_settings import *
import logging
from auto_request import login, click, time_conv
from auto_request import host, user, db, passwd
from auto_request import login, time_conv, get_comment, reply
from auto_request import host, user, db, passwd
def get_data(numtime, numtime2):
try:
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 (create_time >= '2019-05-01 00:00:00.000000' and create_time <= '2019-05-14 00:00:00.000000') and id not in (select topic_id from reply where create_time > '2019-05-01 00:00:00.000000')")
data = cursor.fetchall()
topic_id = list(data)
pc.close()
return topic_id
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
if __name__ == "__main__":
try:
logging.info("comment one")
numtime1, numtime2 = time_conv(5, 0)
user_id = get_data(numtime1, numtime2)
dicts = {}
if user_id:
for i in user_id:
cook = login()
comment = get_comment()
if cook is not None:
reply(cook, i[1], comment)
else:
logging.error("catch exception,main:%s" % traceback.format_exc())
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
import requests
import time
import datetime
import pymysql
import random
import pandas as pd
import traceback
from log_settings import *
import logging
from auto_request import login, time_conv, follow
from auto_request import host, user, port, db, passwd
##做不了
def get_follw_majia(numtime):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute(
"select temp1.user_id,temp1.email,temp2.user_id from account_user_auth temp1 left join (select user_id,follow_id,create_time from user_follow) temp2 on temp1.user_id = temp2.follow_id where temp1.email in ('s_05tmwu@shadow.com','s_07CRHt@shadow.com','s_0bdxxU@shadow.com','s_0mfxcO@shadow.com','s_0u6eaV@shadow.com','s_0UudEr@shadow.com','s_1b3v5V@shadow.com','s_ZVuLyC@shadow.com','s_1dbAoA@shadow.com','s_1dholX@shadow.com','s_1EpLlt@shadow.com') and temp2.create_time like '%%%%%s%%%%' " % (
numtime))
data = cursor.fetchall()
data = list(data)
logging.info("Database version : %s " % data)
pc.close()
return data
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return []
if __name__ == "__main__":
try:
numtime = time_conv(15)
data = get_follw_majia(numtime)
dict_follow_id = {}
if data:
for j in data:
if j[2] != None:
if j[0] not in dict_follow_id.keys():
dict_follow_id.setdefault(j[0], [])
dict_follow_id[j[0]].append(j[2])
else:
dict_follow_id[j[0]].append(j[2])
dict_email = {}
try:
for j in data and data:
if j[2] != None:
if j[0] not in dict_email.keys():
dict_email.setdefault(j[0], [])
dict_email[j[0]].append(j[1])
else:
dict_email[j[0]].append(j[1])
for key, value in dict_follow_id.items():
id = dict_email[key][0]
for i in value:
cookies = login(id)
if cookies is not None:
follow(cookies, i)
except:
pass
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -38,7 +38,7 @@ def get_data(numtime):
if __name__ == "__main__":
try:
numtime = time_conv(3)
numtime = time_conv(3, 2)
user_id = get_data(numtime)
......
......@@ -53,4 +53,4 @@ if __name__ == "__main__":
pass
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
\ No newline at end of file
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -4,17 +4,26 @@ import datetime
import random
import traceback
import logging
import log_settings
import json
import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr
from collections import Counter
auto_click_url = "http://earth.iyanzhi.com/api/v1/like"
auto_reply_url = "http://earth.iyanzhi.com/api/v1/reply/create"
auto_follow_url = "http://earth.iyanzhi.com/api/v1/follow"
auto_urge_url = "http://earth.iyanzhi.com/api/v1/user/urge"
my_sender = 'lixiaofang@igengmei.com'
my_pass = 'tg5AVKBB8jLQGBET'
my_user6 = "lixiaofang@igengmei.com"
# auto_click_url = "http://earth.igengmei.com/api/v1/like"
# auto_reply_url = "http://earth.igengmei.com/api/v1/reply/create"
# auto_follow_url = "http://earth.igengmei.com/api/v1/follow"
# auto_urge_url = "http://earth.igengmei.com/api/v1/user/urge"
# auto_click_url = "http://earth.igengmei.env/api/v1/like"
# auto_reply_url = "http://earth.igengmei.env/api/v1/reply/create"
# auto_follow_url = "http://earth.igengmei.env/api/v1/follow"
# auto_urge_url = "http://earth.igengmei.env/api/v1/user/urge"
# DATABASES = {
# 'default': {
......@@ -46,8 +55,6 @@ DATABASES = {
}
}
host = DATABASES['default']['HOST']
user = DATABASES['default']['USER']
......@@ -122,7 +129,7 @@ def click(cookies_get, id):
data=post_dict)
logging.info("response.text:%s" % response.text)
get_error(response.text)
except:
logging.error("catch exception,logins:%s" % traceback.format_exc())
......@@ -139,19 +146,18 @@ def reply(cookies_get, id, content):
data=post_dict)
logging.info("response.text:%s" % response.text)
get_error(response.text)
except:
logging.error("catch exception,logins:%s" % traceback.format_exc())
def time_conv(minutest,minutest2):
def time_conv(minutest, minutest2):
try:
now = datetime.datetime.now()
yes_time = now - datetime.timedelta(minutes=minutest)
yes_time2 = now - datetime.timedelta(minutes=minutest2)
return yes_time,yes_time2
return yes_time, yes_time2
except:
return None
......@@ -225,7 +231,7 @@ def follow(cookies_get, id):
data=post_dict)
logging.info("response.text:%s" % response.text)
get_error(response.text)
except:
logging.error("catch exception,logins:%s" % traceback.format_exc())
......@@ -241,7 +247,7 @@ def Urge(cookies_get, id):
data=post_dict)
logging.info("response.text:%s" % response.text)
get_error(response.text)
except:
logging.error("catch exception,logins:%s" % traceback.format_exc())
......@@ -295,3 +301,40 @@ def get_user_id():
user_list.append(int(i.strip()))
return user_list
def send_email(stat_data):
ret = True
now = datetime.datetime.now()
yes_time = now - datetime.timedelta(days=1)
yes_time_str = yes_time.strftime('%Y%m%d')
try:
msg = MIMEText(stat_data, 'plain', 'utf-8')
msg['From'] = formataddr(["李小芳", my_sender])
msg["To"] = formataddr(["李小芳", my_user6])
msg['Subject'] = str(datetime.date.today()) + "like的自动点赞出问题了"
server = smtplib.SMTP_SSL("smtp.exmail.qq.com", 465)
server.login(my_sender, my_pass)
server.sendmail(my_sender, [my_user6], msg.as_string())
server.quit()
return ret
except Exception:
ret = False
logging.error("catch exception,main:%s" % traceback.format_exc())
def get_error(line):
try:
if len(line) > 1:
data_dict = json.loads(line)
if data_dict["error"] != 0:
stat_data = "马甲程序出错了"
ret = send_email(stat_data)
if ret:
logging.info('like query统计邮件发送成功')
else:
logging.info('like query统计邮件发送失败')
else:
pass
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
......@@ -16,7 +16,7 @@ def get_star_useid(numtime1, numtime2):
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 > '%s' and create_time < '%s'" % (
numtime1, numtime2))
numtime1, numtime2))
data = cursor.fetchall()
user_id = list(data)
topic_id_list = []
......@@ -35,29 +35,20 @@ def get_star_useid(numtime1, numtime2):
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
if __name__ == "__main__":
try:
time_list = [1, 2, 3, 4, 5, 6, 7]
for i in time_list:
numtime1, numtime2 = time_convs(i + 1, i - 1)
user_id = get_star_useid(numtime1,numtime2)
user_id = get_star_useid(numtime1, numtime2)
try:
for j in user_id and user_id:
id = int(j[0])
for i in range(1):
time.sleep(random.randint(10, 50))
# time.sleep(random.randint(10, 50))
cookies = login()
if cookies is not None:
Urge(cookies, id)
......
......@@ -7,16 +7,17 @@ import traceback
from log_settings import *
import logging
from auto_request import login, time_convs, Urge
from auto_request import host, user, db, passwd
from auto_request import host, port, passwd, user, db
import threading
def get_data(numtime1,numtime2):
def get_data(numtime1, numtime2):
try:
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 > '%s' and create_time < '%s'" % (numtime1,numtime2))
"SELECT distinct(user_id) FROM topic WHERE is_online=1 and create_time > '%s' and create_time < '%s'" % (
numtime1, numtime2))
data = cursor.fetchall()
user_id = list(data)
......@@ -36,32 +37,23 @@ def get_data(numtime1,numtime2):
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
if __name__ == "__main__":
try:
def urge_user():
time_list = [1, 2, 3, 4, 5, 6, 7]
for i in time_list:
numtime1, numtime2 = time_convs(i + 1, i - 1)
user_id = get_data(numtime1,numtime2)
urge_num = random.randint(0, 2)
time_list = [1, 2, 3, 4, 5, 6, 7]
for i in time_list:
numtime1, numtime2 = time_convs(i + 1, i - 1)
logging.info("get numtime1:%s" % numtime1)
user_id = get_data(numtime1, numtime2)
urge_num = random.randint(0, 1)
if urge_num == 1:
for i in range(urge_num):
try:
for j in user_id and user_id:
id = int(j[0])
time.sleep(random.randint(10, 50))
# time.sleep(random.randint(10, 50))
cookies = login()
if cookies is not None:
Urge(cookies, id)
except:
......
import requests
import time
import datetime
import pymysql
import random
import traceback
from log_settings import *
import logging
from auto_request import login, time_convs, Urge
from auto_request import host, port, passwd, user, db
import threading
def get_data(numtime1, numtime2):
try:
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 > '%s' and create_time < '%s'" % (
numtime1, numtime2))
data = cursor.fetchall()
user_id = list(data)
topic_id_list = []
for i in user_id and user_id:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close()
return topic_id_list
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
if __name__ == "__main__":
try:
time_list = [1, 2, 3, 4, 5, 6, 7]
for i in time_list:
numtime1, numtime2 = time_convs(i + 1, i - 1)
logging.info("get numtime1:%s" % numtime1)
user_id = get_data(numtime1, numtime2)
urge_num = random.randint(0, 1)
if urge_num == 1:
for i in range(urge_num):
try:
for j in user_id and user_id:
id = int(j[0])
# time.sleep(random.randint(10, 50))
cookies = login()
if cookies is not None:
Urge(cookies, id)
except:
pass
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
import requests
import time
import datetime
import pymysql
import random
import traceback
from log_settings import *
import logging
from auto_request import login, time_convs, Urge
from auto_request import host, port, passwd, user, db
import threading
def get_data(numtime1, numtime2):
try:
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 > '%s' and create_time < '%s'" % (
numtime1, numtime2))
data = cursor.fetchall()
user_id = list(data)
topic_id_list = []
for i in user_id and user_id:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close()
return topic_id_list
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
if __name__ == "__main__":
try:
time_list = [1, 2, 3, 4, 5, 6, 7]
for i in time_list:
numtime1, numtime2 = time_convs(i + 1, i - 1)
logging.info("get numtime1:%s" % numtime1)
user_id = get_data(numtime1, numtime2)
urge_num = random.randint(0, 1)
if urge_num == 1:
for i in range(urge_num):
try:
for j in user_id and user_id:
id = int(j[0])
# time.sleep(random.randint(10, 50))
cookies = login()
if cookies is not None:
Urge(cookies, id)
except:
pass
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -37,30 +37,21 @@ def get_data(numtime):
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
if __name__ == "__main__":
try:
def urge_user():
numtime1,numtime2 = time_convs(3,2)
user_id = get_data(numtime1)
for j in range(2):
try:
for i in user_id and user_id:
time.sleep(random.randint(10, 15))
cook = login()
if cook is not None:
Urge(cook, i)
except:
pass
numtime1, numtime2 = time_convs(3, 2)
user_id = get_data(numtime1)
for j in range(1):
try:
for i in user_id and user_id:
time.sleep(random.randint(10, 15))
cook = login()
if cook is not None:
Urge(cook, i)
except:
pass
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
\ No newline at end of file
logging.error("catch exception,main:%s" % traceback.format_exc())
import requests
import time
import datetime
import pymysql
import random
import traceback
from log_settings import *
import logging
import threading
from auto_request import login, time_convs, Urge
from auto_request import host, user, db, passwd
def get_data(numtime):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute(
"select distinct(user_id) from account_user_auth where user_id not in (select user_id from pv_maidian where page_name ='home' and partiton_date >= %s)",
(numtime))
data = cursor.fetchall()
user_id = list(data)
topic_id_list = []
for i in user_id and user_id:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close()
return topic_id_list
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
if __name__ == "__main__":
try:
numtime1, numtime2 = time_convs(3, 2)
user_id = get_data(numtime1)
urge_num = random.randint(0, 1)
if urge_num == 1:
try:
for i in user_id and user_id:
time.sleep(random.randint(10, 15))
cook = login()
if cook is not None:
Urge(cook, i)
except:
pass
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -13,17 +13,30 @@ def get_data():
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
user_id_list = []
if user_id:
for i in user_id:
cursor.execute("select user_id from topic where user_id = " + str(
i[0]) + " group by user_id having count(user_id) >5")
data = cursor.fetchall()
user_id = list(data)
if len(user_id):
print(user_id)
user_id_list.append(user_id[0])
else:
paas
pc.close()
return user_id
return user_id_list
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
data = get_data()
print(data)
file = open("user_id.txt", "w")
for i in data:
file.write(i[0])
file.write("\n")
if data:
for i in data:
file.write(str(i[0]))
file.write("\n")
import requests
import pymysql
import random
from log_settings import *
import traceback
import logging
from auto_request import get_offline_comment
from auto_request import host, user, db, passwd
auto_reply_url = "http://saturn.iyanzhi.com/api/v1/reply/create_for_inner"
def reply(id, content, user_id):
try:
post_dict = {
'user_id': user_id,
'topic_id': id,
'content': content
}
response = requests.post(url=auto_reply_url,
data=post_dict)
logging.info("response.text:%s" % response.text)
except:
logging.error("catch exception,logins:%s" % traceback.format_exc())
def get_data(num1, num2):
try:
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 create_time > '2019-05-01 00:00:00:0000' and is_shadow = 1 and content_level in (4,5,6) and id not in (select topic_id from reply where create_time > '2019-05-01 00:00:00:0000')")
data = cursor.fetchall()
topic_id = list(data)
topic_id_list = []
for i in topic_id:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[1]) + " and is_shadow =1")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
pc.close()
logging.info("get topic_id_list:%s" % topic_id_list)
return topic_id_list
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
if __name__ == "__main__":
try:
time_list = [74387, 76585, 117069, 328935, 2798163, 2799359, 2838561, 3190754, 3209576, 3214692, 3348407,
4429049, 6382001, 6544293, 6823318, 6974054, 7237866, 7476106, 8360985, 8601578, 10221636,
10980901, 11141776, 11211574, 11211575, 11411231, 11466431, 11552668, 11653525, 11776166, 11817014,
11972230, 12097639, 12135650, 12453440, 12665859, 13257178, 13599279, 13678365, 14080451, 14157850,
14163222, 14500068, 14555043, 14558956, 14681127, 14690417, 15039277, 15049537, 15073185, 15285940,
15291098, 15298748, 15971036, 16700794, 17477389, 17628547, 17767124, 17773384, 17830042, 18051752,
18055628, 18251036, 18287093, 18308791, 18428002, 18428020, 22744622, 24983861, 31295552, 33418748,
36479190, 36490317, 36578294, 36578342, 37016057, 37163478, 37172979, 37173148, 37173238, 39903458,
41417795, 42366771, 42682900, 42683325, 44614403, 44629365, 44652089, 44653148, 44654235, 45467976,
45852874, 45910310, 45978527, 46613768, 46614254, 46614302, 46614304, 46614371, 46614566, 46614568,
46614570, 46614589, 46614601, 46614603, 46614652, 46614654, 46614655, 46614665, 46614666, 46614676,
46614677, 46614678, 46614704, 46614715, 46614734, 46614745, 46614750, 46614763, 46614806, 46614811,
46614814, 46614844, 46614867, 46614953, 46614974, 46615298, 46615303, 46615444, 46615448, 46615692,
46615806, 46615811, 46615814, 46615819, 46615820, 46615822, 46615825, 46615826, 46616125, 46616141,
46616144, 46616146, 46616148, 46616150, 46616153, 46616158, 46616159, 46616161, 46616169, 46616173,
46616177, 46616179, 46616180, 46616182, 46616186, 46616187, 46616188, 46616209, 46616212, 46616233,
46616235, 46616237, 46616242, 46616250, 46616256, 46616262, 46616276, 46616345, 46616361, 46616522,
46618060, 46618369, 46618394, 46618454, 46618666, 46618675, 46618680, 46618683, 46618701, 46618708,
46618710, 46618740, 46618752, 46618755, 46618792, 46618800, 46618816, 46618818, 46618819, 46618826,
46618830, 46619562, 46619756, 46619871, 46620004, 46620025, 46620029, 46620039, 46620043, 46620046,
46620055, 46620059, 46620064, 46620070, 46620073, 46620098, 46620107, 46620121, 46620135, 46620146,
46620149, 46620163, 46620175, 46620178, 46620181, 46620191, 46620194, 46620196, 46628317, 46628364,
46628365, 46628367, 46628371, 46628372, 46628420, 46628425, 46628535, 46628566, 46628573, 46628575,
46628580, 46628583, 46628585, 46628587, 46628592, 46628593, 46628594, 46628595, 46628596, 46628600,
46628601, 46628602, 46628605, 46628606, 46628607, 46628608, 46628609, 46628611, 46628612, 46628614,
46628615, 46628616, 46628617, 46628619, 46628620, 46628622, 46628624, 46628627, 46628628, 46628630,
46628635, 46628637, 46628638, 46628640, 46628644, 46628646, 46628648, 46628649, 46628652, 46628654,
46628655, 46628656, 46628658, 46628659, 46628660, 46628662, 46628667, 46628668, 46628669, 46628670,
46628673, 46628680, 46628681, 46628682, 46628683, 46628685, 46628687, 46628688, 46628690, 46628691,
46628695, 46628697, 46628698, 46628700, 46628704, 46628708, 46628709, 46628710, 46628711, 46628712,
46628713, 46628714, 46628715, 46628717, 46628718, 46628721, 46628723, 46628728, 46628731, 46628732,
46628734, 46628736, 46628738, 46628739, 46628742, 46628743, 46628745, 46628746, 46628748, 46628750,
46628751, 46628752, 46628753, 46628755, 46628756, 46628757, 46628758, 46628760, 46628761, 46628764,
46628766, 46628770, 46628773, 46628774, 46628775, 46628779, 46628780, 46628781, 46628783, 46628790,
46628795, 46628796, 46628799, 46628800, 46628801, 46628802, 46628803, 46628805, 46628808, 46628810,
46628812, 46628817, 46628820, 46628823, 46628824, 46628828, 46628829, 46628835, 46628836, 46628838,
46628839, 46628844, 46628845, 46628846, 46628849, 46628852, 46628854, 46628855, 46628856, 46628858,
46628859, 46628863, 46628864, 46628867, 46628868, 46628874, 46628875, 46628878, 46628880, 46628881,
46628882, 46628885, 46628890, 46628895, 46628896, 46628898, 46628900, 46628901, 46628905, 46628913,
46628928, 46628929, 46628933, 46628939, 46628940, 46628942, 46628943, 46628944, 46628955, 46628956,
46628961, 46628962, 46628963, 46628965, 46628966, 46628971, 46628973, 46628974, 46628976, 46628977,
46628978, 46628979, 46628980, 46628984, 46628987, 46628991, 46628993, 46628995, 46628998, 46629000,
46629003, 46629006, 46629007, 46629008, 46629009, 46629010, 46629011, 46629012, 46629014, 46629016,
46629017, 46629020, 46629022, 46629024, 46629031, 46629032, 46629033, 46629039, 46629042, 46629043,
46629046, 46629048, 46629052, 46629053, 46629057, 46629059, 46629079, 46629085, 46629097, 46629105,
46629106, 46629107, 46629108, 4662911346629114, 46629117, 46629118, 46629120, 46629128, 46629130,
46629131, 46629132, 46629134, 46629135, 46629137, 46629139, 46629140, 46629142, 46629144, 46629147,
46629149, 46629150, 46629152, 46629153, 46629155, 46629156, 46629157, 46629161, 46629163, 46629164,
46629170, 46629171, 46629172, 46629175, 46629176, 46629182, 46629184, 46629186, 46629188, 46629189,
46629192, 46629193, 46629199, 46629201, 46629203, 46629204, 46629205, 46629207, 46629211, 46629212,
46629213, 46629218, 46629220, 46629224, 46629225, 46629226, 46629227, 46629229, 46629230, 46629232,
46629233, 46629234, 46629239, 46629243, 46629252, 46629264, 46629270, 46629274, 46629278, 46629285,
46629295, 4662930446629305, 46629309, 46629313, 46629329, 46629334, 46629338, 46629339, 46629358,
46629374, 46629385, 46629416, 46629419, 46629424, 46629683, 46629740, 46629782, 46629804, 46629820,
46629877, 46630485]
user_data = open("/srv/apps/cybertron/user_id.txt", "r")
user_list = []
for i in user_data.readlines():
user_list.append(i)
dicts = {}
for id in time_list:
dicts = {}
rand_num = random.randint(0, 3)
for i in range(rand_num):
num = random.randint(0, len(user_list) - 1)
user_id = user_list[num]
comment_list = get_offline_comment()
comment = comment_list[i]
logging.info("get id :%s" % id)
reply(id, comment, user_id)
except:
logging.error("catch exception,main :%s" % traceback.format_exc())
......@@ -32,8 +32,7 @@ def get_data(num1, num2):
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 (id > " + str(num1) + " and id <= " + str(
num2) + ") and (content_level = 4 or content_level = 5) ")
"select id,user_id from topic where create_time > '2019-05-01 00:00:00:0000' and is_shadow = 1 and content_level in (4,5,6) and id not in (select topic_id from reply where create_time > '2019-05-01 00:00:00:0000')")
data = cursor.fetchall()
topic_id = list(data)
topic_id_list = []
......@@ -55,37 +54,33 @@ def get_data(num1, num2):
if __name__ == "__main__":
try:
time_list = [[24373571, 34000000],
[34000001, 45974231]]
time_list = [76585, 328935, 11653525, 14157850, 14558956, 15049537, 24983861, 33418748, 36479190,
36578342, 37016057, 42366771, 46628585, 46628600, 46628601, 46628602, 46628620, 46628635,
46628640, 46628649, 46628654, 46628655, 46628656, 46628659, 46628662, 46628669, 46628680,
46628681, 46628685, 46628688, 46628691, 46628697, 46628710, 46628736, 46628743, 46628746,
46628748, 46628756, 46628757, 46628764, 46628780, 46628790, 46628796, 46628805, 46628812,
46628849, 46628852, 46628868, 46628875, 46628890, 46628900, 46628901, 46628905, 46628928,
46628929, 46628943, 46628944, 46628956, 46628963, 46628965, 46628974, 46628979, 46629031,
46629032, 46629057, 46629107, 46629113, 46629114, 46629117, 46629132, 46629134, 46629137,
46629139, 46629142, 46629152, 46629157, 46629170, 46629193, 46629201, 46629203, 46629204,
46629205, 46629207, 46629211, 46629227, 46629230, 46629232, 46629252, 46629274, 46629304,
46629305, 46629309, 46629313, 46629338, 46629419, 46630746
]
user_data = open("/srv/apps/cybertron/user_id.txt", "r")
user_list = []
for i in user_data.readlines():
user_list.append(i)
for i in time_list:
topic_id = get_data(i[0], i[1])
dicts = {}
for id in time_list:
dicts = {}
for id in topic_id and topic_id:
rand_num = random.randint(0, 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)
rand_num = random.randint(1, 1)
for i in range(rand_num):
num = random.randint(0, len(user_list) - 1)
user_id = user_list[num]
comment_list = get_offline_comment()
comment = comment_list[i]
logging.info("get id :%s" % id)
reply(id, comment, user_id)
except:
......
import requests
import pymysql
import random
from log_settings import *
import traceback
import logging
import datetime
from auto_request import get_offline_comment
from auto_request import host, user, db, passwd
auto_reply_url = "http://saturn.iyanzhi.com/api/v1/reply/create_for_inner"
def reply(id, content, user_id):
try:
post_dict = {
'user_id': user_id,
'topic_id': id,
'content': content
}
response = requests.post(url=auto_reply_url,
data=post_dict)
logging.info("response.text:%s" % response.text)
except:
logging.error("catch exception,logins:%s" % traceback.format_exc())
def get_data(now, noww):
try:
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) " % (
now, noww))
data = cursor.fetchall()
topic_id = list(data)
topic_id_list = []
for i in topic_id:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[1]) + " and is_shadow =1")
data = cursor.fetchall()
user_id = list(data)
if user_id:
topic_id_list.append(i)
pc.close()
logging.info("get topic_id_list:%s" % topic_id_list)
return topic_id_list
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
if __name__ == "__main__":
try:
now = datetime.datetime.now()
yes_time = now - datetime.timedelta(minutes=5)
user_data = open("/srv/apps/cybertron/user_id.txt", "r")
user_list = []
for i in user_data.readlines():
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)
except:
logging.error("catch exception,main :%s" % traceback.format_exc())
import requests
import pymysql
import random
from log_settings import *
import traceback
import logging
import datetime
from auto_request import get_offline_comment
from auto_request import host, user, db, passwd
auto_reply_url = "http://saturn.iyanzhi.com/api/v1/reply/create_for_inner"
def reply(id, content, user_id):
try:
post_dict = {
'user_id': user_id,
'topic_id': id,
'content': content
}
response = requests.post(url=auto_reply_url,
data=post_dict)
logging.info("response.text:%s" % response.text)
except:
logging.error("catch exception,logins:%s" % traceback.format_exc())
def get_data(now):
try:
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 content_level = 6")
data = cursor.fetchall()
topic_id = list(data)
topic_id_list = []
for i in topic_id:
cursor.execute(
"select topic_id from reply where topic_id =" + str(i[0]))
data = cursor.fetchall()
user_id = list(data)
if len(user_id) == 0:
topic_id_list.append(i)
pc.close()
logging.info("get topic_id_list:%s" % topic_id_list)
return topic_id_list
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
if __name__ == "__main__":
try:
now = datetime.datetime.now()
yes_time = now - datetime.timedelta(days=6)
yes_time_str = yes_time.strftime('%Y-%m-%d')
user_data = open("/srv/apps/cybertron/user_id.txt", "r")
user_list = []
for i in user_data.readlines():
user_list.append(i)
topic_id = get_data(yes_time_str)
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)
except:
logging.error("catch exception,main :%s" % traceback.format_exc())
213
13
13
13
31
1
3
13
13
13
\ No newline at end of file
This diff is collapsed.
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