Commit d07f21c9 authored by 吴升宇's avatar 吴升宇

fix auto_follow_per_5m_by_followed

parent 8e17c112
This diff is collapsed.
......@@ -3,7 +3,7 @@ import traceback
import logging
from vest.request.auto_request import login, follow, time_conv
from vest.request.auto_request import host, user, db, passwd
from vest.data.majia_user_ids import majia_user_ids_list
from vest.data.majia_user_ids import majia_user_ids_list, majia_user_ids_dict
from libs.error import logging_exception
......@@ -12,7 +12,7 @@ def get_user_id(numtime):
cursor = pc.cursor()
majia_user_ids_tuple = tuple(majia_user_ids_list)
cursor.execute(
"SELECT user_id FROM user_follow WHERE create_time > '%s' and follow_id in %s " % (numtime, str(majia_user_ids_tuple))
"SELECT user_id, follow_id FROM user_follow WHERE create_time > '%s' and follow_id in %s " % (numtime, str(majia_user_ids_tuple))
)
data_comment = cursor.fetchall()
return data_comment and [i for i in data_comment] or []
......@@ -22,10 +22,11 @@ def auto_follow_per_5m_by_followed():
# 如果马甲被用户关注,马甲即反向关注用户, 被关注5分钟后
try:
numtime1, numtime2 = time_conv(1, 5)
user_ids = get_user_id(numtime2)
users = get_user_id(numtime2)
try:
for user_id in user_ids and user_ids:
cookies = login()
for user in users and users:
user_id = user[0]
cookies = login(majia_user_ids_dict.get(user[1]))
if cookies is not None:
follow(cookies, user_id)
except:
......
......@@ -82,8 +82,9 @@ def get_cookies(user_id):
return None
def login():
def login(user_id=None):
try:
if not user_id:
user_id = get_majia()
logging.info("get user_id:%s" % 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