-
Notifications
You must be signed in to change notification settings - Fork 1
/
Run.py
71 lines (63 loc) · 1.73 KB
/
Run.py
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import threading
import logging
import libs.mail
import Config
from Sign import Sign
from Login import Login
import Data
def DoTasker():
lstUserData = Data.laodUserData()
emails = []
for d in lstUserData:
login = Login(d[0], d[1])
skey, reason = login.autologin()
if skey == False:
#签到失败,删除用户信息,发送邮件提醒
email = Data.getUserEmailData(d[0])
if email != None and len(email)>0:
emails.append(email)
Data.removeUserData(d[0])
Data.removeUserEmailData(d[0])
sign = Sign(d[0], skey)
if sign.autosign() == False:
pass
#time.sleep(1)
#print emails
if len(emails)>0:
email = libs.mail.Message(Config.smtp_user, emails, Config.mail_notify)
try:
conn = libs.mail.Connection(Config.smtp_server, 25 ,Config.smtp_user, Config.smtp_pass)
conn.send_message(email)
except:
pass
#Data.updateUserData(310301913,'@H7s4VGTuy')
#Data.updateUserEmailData(310301913,'310301913@qq.com')
#time.sleep(0.1)
#DoTasker()
def Loop():
logging.info('Loop begining ...')
while True:
#0000
min = int(time.strftime("%H%M"))
if min == 0 or min == 1200:
logging.info('DoTasker...')
DoTasker()
time.sleep(60)
else:
time.sleep(1)
def Run():
thread = threading.Thread(target=Loop)
thread.daemon = True
logging.info('DoTasker...')
thread.start()
#Run()
#while True:
# time.sleep(1)
def test():
Data.updateUserData(310301913, '@Fr2YJJNqd')
#wait sql write
time.sleep(0.1)
DoTasker()