Commit 40692df0 authored by lixiaofang's avatar lixiaofang

add

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