Commit f78b00d7 authored by lixiaofang's avatar lixiaofang

add

parent cba8d966
import pymysql import pymysql
import traceback import traceback
import logging import logging
import json
from vest.request.auto_request import host, user, db, passwd from vest.request.auto_request import host, user, db, passwd
from libs.cache import redis_client from libs.cache import redis_client
from libs.error import logging_exception from libs.error import logging_exception
...@@ -38,7 +39,7 @@ def auto_user_id(): ...@@ -38,7 +39,7 @@ def auto_user_id():
for i in data: for i in data:
file.write(str(i[0])) file.write(str(i[0]))
file.write("\n") file.write("\n")
redis_client.set("get_user_id_data", data) redis_client.set("get_user_id_data", json.dumps(data))
except: except:
logging_exception() logging_exception()
......
...@@ -3,7 +3,9 @@ import pymysql ...@@ -3,7 +3,9 @@ import pymysql
import random import random
import traceback import traceback
import logging import logging
import json
import datetime import datetime
from libs.cache import redis_client
from vest.request.auto_request import get_offline_comment from vest.request.auto_request import get_offline_comment
from vest.request.auto_request import host, user, db, passwd from vest.request.auto_request import host, user, db, passwd
from libs.error import logging_exception from libs.error import logging_exception
...@@ -60,14 +62,16 @@ def vest_click_reply(): ...@@ -60,14 +62,16 @@ def vest_click_reply():
logging.info("get majia data11111111111") logging.info("get majia data11111111111")
now = datetime.datetime.now() now = datetime.datetime.now()
yes_time = now - datetime.timedelta(minutes=5) yes_time = now - datetime.timedelta(minutes=5)
user_data = open("/srv/apps/physical/vest/data/user_id.txt", "r") data = json.loads(redis_client.get("get_user_id_data"))
# user_data = open("/srv/apps/physical/vest/data/get_user_id.txt", "r")
user_list = [] user_list = []
for i in user_data.readlines(): for i in data.readlines():
user_list.append(i) user_list.append(i)
topic_id = get_data(yes_time, now) topic_id = get_data(yes_time, now)
if topic_id: if topic_id:
for id in topic_id: for id in topic_id:
rand_num = random.randint(1, 3) rand_num = random.randint(0, 4)
for i in range(rand_num): for i in range(rand_num):
num = random.randint(0, len(user_list) - 1) num = random.randint(0, len(user_list) - 1)
user_id = user_list[num] user_id = user_list[num]
......
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