mirror of https://github.com/testerSunshine/12306
parent
fb03acd46f
commit
cfebf48646
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import datetime
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
@ -23,6 +23,7 @@ seat_conf = {'商务座': 32,
|
||||||
'特等座': 25,
|
'特等座': 25,
|
||||||
'软卧': 23,
|
'软卧': 23,
|
||||||
'硬卧': 28,
|
'硬卧': 28,
|
||||||
|
'软座': 24,
|
||||||
'硬座': 29,
|
'硬座': 29,
|
||||||
'无座': 26,
|
'无座': 26,
|
||||||
}
|
}
|
||||||
|
@ -95,3 +96,14 @@ def getVCodeImageFile(imageName):
|
||||||
|
|
||||||
def getCacheFile(cacheType):
|
def getCacheFile(cacheType):
|
||||||
return os.path.join(getCacheDir(), cacheType + ".cache")
|
return os.path.join(getCacheDir(), cacheType + ".cache")
|
||||||
|
|
||||||
|
|
||||||
|
def checkSleepTime(session):
|
||||||
|
now = datetime.datetime.now()
|
||||||
|
if now.hour >= 23 or now.hour < 6:
|
||||||
|
print(u"12306休息时间,本程序自动停止,明天早上七点将自动运行")
|
||||||
|
open_time = datetime.datetime(now.year, now.month, now.day, 6)
|
||||||
|
if open_time < now:
|
||||||
|
open_time += datetime.timedelta(1)
|
||||||
|
time.sleep((open_time - now).seconds)
|
||||||
|
session.call_login()
|
||||||
|
|
|
@ -5,7 +5,7 @@ set:
|
||||||
# - 2018-01-06
|
# - 2018-01-06
|
||||||
# - 2018-01-07
|
# - 2018-01-07
|
||||||
station_dates:
|
station_dates:
|
||||||
- "2019-01-11"
|
- "2019-02-02"
|
||||||
|
|
||||||
# 是否根据时间范围 和 乘车类型 购票
|
# 是否根据时间范围 和 乘车类型 购票
|
||||||
# 否则将需要手动填写车次
|
# 否则将需要手动填写车次
|
||||||
|
@ -45,15 +45,18 @@ set:
|
||||||
# - "G1021"
|
# - "G1021"
|
||||||
# - "G99"
|
# - "G99"
|
||||||
# - "G6011"
|
# - "G6011"
|
||||||
- "D2972"
|
# - "D2972"
|
||||||
- "D1874"
|
# - "D1874"
|
||||||
- "D2834"
|
# - "D2834"
|
||||||
|
- "G6172"
|
||||||
|
- "G6186"
|
||||||
|
- "G6154"
|
||||||
|
|
||||||
# 出发城市,比如深圳北,就填深圳就搜得到
|
# 出发城市,比如深圳北,就填深圳就搜得到
|
||||||
from_station: "广州南"
|
from_station: "广州南"
|
||||||
|
|
||||||
# 到达城市 比如深圳北,就填深圳就搜得到
|
# 到达城市 比如深圳北,就填深圳就搜得到
|
||||||
to_station: "三江南"
|
to_station: "邵阳"
|
||||||
|
|
||||||
# 座位(list) 多个座位ex:
|
# 座位(list) 多个座位ex:
|
||||||
# - "二等座"
|
# - "二等座"
|
||||||
|
@ -68,8 +71,9 @@ set:
|
||||||
# - "张三"
|
# - "张三"
|
||||||
# - "李四"
|
# - "李四"
|
||||||
ticke_peoples:
|
ticke_peoples:
|
||||||
# - "文贤平"
|
- "文贤平"
|
||||||
- "梁敏"
|
- "李梦云"
|
||||||
|
# - "梁敏"
|
||||||
# 12306登录账号(list)
|
# 12306登录账号(list)
|
||||||
12306account:
|
12306account:
|
||||||
- user: "931128603@qq.com"
|
- user: "931128603@qq.com"
|
||||||
|
@ -79,7 +83,7 @@ set:
|
||||||
ticket_black_list_time: 5
|
ticket_black_list_time: 5
|
||||||
|
|
||||||
# 自动打码
|
# 自动打码
|
||||||
is_auto_code: True
|
is_auto_code: False
|
||||||
|
|
||||||
# 打码平台, 2 为若快平台(目前只支持若快平台打码,打码兔已经关闭), 若快注册地址:http://www.ruokuai.com/client/index?6726
|
# 打码平台, 2 为若快平台(目前只支持若快平台打码,打码兔已经关闭), 若快注册地址:http://www.ruokuai.com/client/index?6726
|
||||||
auto_code_type: 2
|
auto_code_type: 2
|
||||||
|
@ -114,14 +118,14 @@ email_conf:
|
||||||
is_cdn: 1
|
is_cdn: 1
|
||||||
|
|
||||||
# 下单接口分为两种,1 为快速下单,2 是普通下单
|
# 下单接口分为两种,1 为快速下单,2 是普通下单
|
||||||
order_type: 1
|
order_type: 2
|
||||||
|
|
||||||
# 下单模式 1 为预售,整点刷新,刷新间隔0.1-0.5S, 然后会校验时间,比如12点的预售,那脚本就会在12.00整检票,刷新订单
|
# 下单模式 1 为预售,整点刷新,刷新间隔0.1-0.5S, 然后会校验时间,比如12点的预售,那脚本就会在12.00整检票,刷新订单
|
||||||
# 2 是捡漏,捡漏的刷新间隔时间为0.5-3秒,时间间隔长,不容易封ip
|
# 2 是捡漏,捡漏的刷新间隔时间为0.5-3秒,时间间隔长,不容易封ip
|
||||||
order_model: 2
|
order_model: 2
|
||||||
|
|
||||||
# 预售放票时间, 如果是捡漏模式,可以忽略此操作
|
# 预售放票时间, 如果是捡漏模式,可以忽略此操作
|
||||||
open_time: '20:15:00'
|
open_time: '13:00:00'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import time
|
||||||
import wrapcache
|
import wrapcache
|
||||||
|
|
||||||
from agency.cdn_utils import CDNProxy
|
from agency.cdn_utils import CDNProxy
|
||||||
from config import urlConf
|
from config import urlConf, configCommon
|
||||||
from config.AutoSynchroTime import autoSynchroTime
|
from config.AutoSynchroTime import autoSynchroTime
|
||||||
from config.TicketEnmu import ticket
|
from config.TicketEnmu import ticket
|
||||||
from config.configCommon import seat_conf
|
from config.configCommon import seat_conf
|
||||||
|
@ -190,13 +190,7 @@ class select:
|
||||||
try:
|
try:
|
||||||
num += 1
|
num += 1
|
||||||
now = datetime.datetime.now() # 感谢群里大佬提供整点代码
|
now = datetime.datetime.now() # 感谢群里大佬提供整点代码
|
||||||
if now.hour >= 23 or now.hour < 6:
|
configCommon.checkSleepTime(self) # 晚上到点休眠
|
||||||
print(u"12306休息时间,本程序自动停止,明天早上七点将自动运行")
|
|
||||||
open_time = datetime.datetime(now.year, now.month, now.day, 6)
|
|
||||||
if open_time < now:
|
|
||||||
open_time += datetime.timedelta(1)
|
|
||||||
time.sleep((open_time - now).seconds)
|
|
||||||
self.call_login()
|
|
||||||
if self.order_model is 1:
|
if self.order_model is 1:
|
||||||
sleep_time_s = 0.5
|
sleep_time_s = 0.5
|
||||||
sleep_time_t = 0.6
|
sleep_time_t = 0.6
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import datetime
|
import datetime
|
||||||
import wrapcache
|
import wrapcache
|
||||||
|
|
||||||
|
from config import configCommon
|
||||||
from config.TicketEnmu import ticket
|
from config.TicketEnmu import ticket
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +17,7 @@ class checkUser:
|
||||||
"""
|
"""
|
||||||
CHENK_TIME = 0.3
|
CHENK_TIME = 0.3
|
||||||
while 1:
|
while 1:
|
||||||
|
configCommon.checkSleepTime(self.session) # 修复晚上查询线程休眠时,检查登录线程为休眠,造成快豆迅速消耗
|
||||||
if wrapcache.get("user_time") is None:
|
if wrapcache.get("user_time") is None:
|
||||||
check_user_url = self.session.urls["check_user_url"]
|
check_user_url = self.session.urls["check_user_url"]
|
||||||
data = {"_json_att": ""}
|
data = {"_json_att": ""}
|
||||||
|
|
|
@ -48,6 +48,7 @@ class getPassengerDTOs:
|
||||||
'商务座': 9,
|
'商务座': 9,
|
||||||
'硬座': 1,
|
'硬座': 1,
|
||||||
'无座': 1,
|
'无座': 1,
|
||||||
|
'软座': 2,
|
||||||
'软卧': 4,
|
'软卧': 4,
|
||||||
'硬卧': 3,
|
'硬卧': 3,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue