Repository navigation
Expand file tree
/
Copy pathmain.py
More file actions
87 lines (79 loc) · 3.09 KB
/
Copy pathmain.py
File metadata and controls
87 lines (79 loc) · 3.09 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import time,os,pyperclip
from datetime import datetime
from Scripts.utils import *
from Scripts.init import *
from Scripts.time import *
cookies=""
money="0.01"
version="1.0.0"
password="123456"
def load_config():
if not os.path.exists("data.json"): return False
reload=noneprompt.ListPrompt(
question="是否加载上次的配置?",
choices=[noneprompt.Choice(name=x)
for x in ["是","否"]
],
).prompt().name
if reload=="是" and os.path.exists("data.json"):
return True
else:
return False
if __name__ == "__main__":
init(version)
if not load_config():
logger.warning("请确保你的一卡通余额充足,否则可能会导致充值失败!")
logger.warning("cookies通过抓包获得,在企业微信 A-校园一卡通里可随便抓到,格式为:Jgg-User=Jgg-User-oKJ_xxxxxxxxxxxxxxx; ASP.NET_SessionId=xxxxxxxxxxxxx")
try:
clip_value = pyperclip.paste()
logger.info("剪贴板复制成功")
except pyperclip.PyperclipException:
clip_value = ""
cookies=noneprompt.InputPrompt(
question="请输入你的一卡通cookies",
default_text=clip_value,
).prompt()
money=noneprompt.InputPrompt(
question="请输入要充值的金额,默认为0.01,单位为元",
default_text="0.01"
).prompt()
password=noneprompt.InputPrompt(
question="请输入你的一卡通密码,用于支付",
).prompt()
charge_self=AutoCharge(cookies,money,password,False)
YZM=AutoCharge.get_YZM(charge_self)
AutoCharge.get_cookies(charge_self,YZM)
AutoCharge.choose_room(charge_self)
AutoCharge.update_cookies(charge_self)
AutoCharge.save(charge_self)
else:
charge_self=AutoCharge(None,None,None,True)
logger.info("Starting...")
mode=noneprompt.ListPrompt(
"请选择模式",
choices=[noneprompt.Choice(name=x)
for x in ["定时充值","直接充值"]
],
).prompt().name
if mode=="直接充值":
if charge_self.verfication_token:
AutoCharge.submit(charge_self)
else:
AutoCharge.get_Vtoken(charge_self,"")
AutoCharge.submit(charge_self)
else:
now = datetime.now()
while True:
if now.weekday() != datetime.now().weekday():
AutoCharge.get_Vtoken(charge_self)
AutoCharge.save(charge_self)
now = datetime.now()
if datetime.now().hour>1 and datetime.now().hour<22:
logger.info("未到时间,睡眠中...")
time.sleep(3600)
else:
time_self=Time()
if Time.count(time_self):
AutoCharge.submit(charge_self)
logger.info("已充值,请留意是否来电")
time.sleep(33)