1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import pymysql
import random
import traceback
import logging
from vest.request.auto_request import login, time_convs, Urge
from vest.request.auto_request import host, user, passwd
from libs.error import logging_exception
def get_data(numtime):
try:
pc = pymysql.connect(host=host, user=user, passwd=passwd, db="physical", port=3306)
cursor = pc.cursor()
cursor.execute(
"select user_id from sl_user_login_status where last_visit_day < '%s' and is_shadow = 0 " % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
pc.close()
return user_id
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
def auto_lunch_app2():
try:
numtime1, numtime2 = time_convs(1, 3)
user_id = get_data(numtime2)
for i in user_id and user_id:
num = random.randint(0, 1)
if num == 1:
id = int(i[0])
cook = login()
if cook is not None:
Urge(cook, id)
except:
logging_exception()
logging.error("catch exception,main:%s" % traceback.format_exc())