Commit 40692df0 authored by lixiaofang's avatar lixiaofang

add

parent 6c25e328
This diff is collapsed.
import requests
import time import time
import datetime
import pymysql import pymysql
import random import random
import traceback import traceback
......
...@@ -30,6 +30,7 @@ DATABASES = { ...@@ -30,6 +30,7 @@ DATABASES = {
} }
} }
host = DATABASES['default']['HOST'] host = DATABASES['default']['HOST']
user = DATABASES['default']['USER'] user = DATABASES['default']['USER']
......
...@@ -8,8 +8,6 @@ from log_settings import * ...@@ -8,8 +8,6 @@ from log_settings import *
def get_data(): def get_data():
try: try:
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("select user_id from user_extra where is_shadow = 1 ") cursor.execute("select user_id from user_extra where is_shadow = 1 ")
...@@ -21,8 +19,6 @@ def get_data(): ...@@ -21,8 +19,6 @@ def get_data():
except: except:
logging.error("catch exception,get_data:%s" % traceback.format_exc()) logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None return None
data = get_data() data = get_data()
file = open("user_id.txt","w") file = open("user_id.txt","w")
......
import requests import requests
import time
import datetime
import pymysql import pymysql
import random import random
import pandas as pd
import traceback
from log_settings import * from log_settings import *
import traceback
import logging import logging
from auto_request import get_offline_comment from auto_request import get_offline_comment
from auto_request import host, user, db, passwd from auto_request import host, user, db, passwd
...@@ -31,7 +28,6 @@ def get_user_id(): ...@@ -31,7 +28,6 @@ def get_user_id():
return user_list return user_list
def reply(id, content, user_id): def reply(id, content, user_id):
try: try:
post_dict = { post_dict = {
...@@ -54,44 +50,30 @@ def get_data(num1, num2): ...@@ -54,44 +50,30 @@ def get_data(num1, num2):
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 (id > 0 and id <= 10000) and (content_level = 4 or content_level = 5) ") "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) ")
data = cursor.fetchall() data = cursor.fetchall()
topic_id = list(data) topic_id = list(data)
# logging.info("Database version : %s " % topic_id)
user_list = get_user_id() user_list = get_user_id()
# logging.info("get user_list:%s"%user_list)
topic_id_list = [] topic_id_list = []
if topic_id: if topic_id:
for i in topic_id: for i in topic_id:
print(i[1])
print("========")
if int(i[1]) in user_list: if int(i[1]) in user_list:
topic_id_list.append(i) topic_id_list.append(i)
print(i)
print("--------")
pc.close() pc.close()
print(topic_id_list) logging.info("get topic_id_list:%s" % topic_id_list)
return topic_id_list return topic_id_list
except: except:
logging.error("catch exception,get_data:%s" % traceback.format_exc()) logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None return None
if __name__ == "__main__": if __name__ == "__main__":
try: try:
time_list = [[0, 10000], [10000, 20000]] time_list = [[0, 100000], [100000, 200000], [200000, 300000], [300000, 400000],
# [10000, 20000], [400000, 500000][600000, 700000]]
# [20000, 30000],
# ["2017-03-30 15:57:49.000000", "2016-03-30 15:57:49.000000"],
# ["2018-03-30 15:57:49.000000", "2017-03-30 15:57:49.000000"],
# ["2019-03-30 15:57:49.000000", "2018-03-30 15:57:49.000000"]]
user_data = open("user_id.txt", "r") user_data = open("user_id.txt", "r")
......
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