Commit 239a34d5 authored by lixiaofang's avatar lixiaofang

add

parent d59a3444
This diff is collapsed.
......@@ -5,22 +5,28 @@ import pymysql
import random
import traceback
import logging
from auto_request import login, time_convs, reply, get_comment
from auto_request import login, time_convs, reply, get_comment,get_user_id
from auto_request import host, user, port, db, passwd
import
def get_topic_id(numtime):
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 LIKE '%%%%%s%%%%' and user_id in (select user_id from user_extra where is_shadow = 0) " % numtime)
"SELECT user_id,id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%' " % numtime)
data = cursor.fetchall()
topic_id = list(data)
logging.info("Database version : %s " % topic_id)
user_list = get_user_id()
topic_id_list = []
if topic_id:
for i in topic_id:
if int(i[1]) in user_list:
topic_id_list.append(i)
logging.info("Database version : %s " % topic_id_list)
pc.close()
return topic_id
return topic_id_list
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
......
......@@ -263,3 +263,12 @@ def get_offline_comment():
# logging.error("catch exception,logins:%s" % traceback.format_exc())
#
# return None
def get_user_id():
user_data = open("user_id.txt", "r")
user_list = []
for i in user_data.readlines():
user_list.append(int(i.strip()))
return user_list
\ No newline at end of file
......@@ -4,7 +4,7 @@ import random
from log_settings import *
import traceback
import logging
from auto_request import get_offline_comment
from auto_request import get_offline_comment,get_user_id
from auto_request import host, user, db, passwd
auto_reply_url = "http://47.93.162.11:8085/api/v1/reply/create_for_inner"
......@@ -18,14 +18,7 @@ auto_reply_url = "http://47.93.162.11:8085/api/v1/reply/create_for_inner"
#
# 注意需要禁止本帖作者评论
def get_user_id():
user_data = open("user_id.txt", "r")
user_list = []
for i in user_data.readlines():
user_list.append(int(i.strip()))
return user_list
def reply(id, content, user_id):
......
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