mirror of https://github.com/testerSunshine/12306
fix
parent
2a46ccddb4
commit
0735431cd9
|
@ -68,4 +68,3 @@
|
||||||
- 优化查票流程
|
- 优化查票流程
|
||||||
- 修改二等座的余票数返回为字符串的问题
|
- 修改二等座的余票数返回为字符串的问题
|
||||||
- 优化订单查询bug
|
- 优化订单查询bug
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,10 @@
|
||||||
#to_station: 到达站
|
#to_station: 到达站
|
||||||
#set_type: 坐席(商务座,二等座,特等座,软卧,硬卧,硬座,无座)
|
#set_type: 坐席(商务座,二等座,特等座,软卧,硬卧,硬座,无座)
|
||||||
#is_more_ticket:余票不足是否自动提交
|
#is_more_ticket:余票不足是否自动提交
|
||||||
#select_refresh_interval:抢票刷新间隔时间,1为一秒,0.1为100毫秒,以此类推
|
#select_refresh_interval:抢票刷新间隔时间,1为一秒,0.1为100毫秒,以此类推 如果捡漏推荐为1秒,刷票设置0.01
|
||||||
#expect_refresh_interval:售票未开始,等待刷新间隔时间,1为一秒,0.1为100毫秒,以此类推
|
#expect_refresh_interval:售票未开始,等待刷新间隔时间,1为一秒,0.1为100毫秒,以此类推
|
||||||
#ticket_black_list:加入小黑屋的等待时间,默认3 min
|
#ticket_black_list:加入小黑屋的等待时间,默认3 min
|
||||||
|
#enable_proxy:是否开启代理模式,代理速度比较慢,如果是抢票阶段,不建议开启
|
||||||
#ticke_peoples: 乘客
|
#ticke_peoples: 乘客
|
||||||
#damatu:打码兔账号,用于自动登录
|
#damatu:打码兔账号,用于自动登录
|
||||||
#is_aotu_code是否自动打码,如果选择Ture,则调用打码兔打码,默认不使用打码兔
|
#is_aotu_code是否自动打码,如果选择Ture,则调用打码兔打码,默认不使用打码兔
|
||||||
|
@ -39,7 +40,7 @@ set:
|
||||||
set_type:
|
set_type:
|
||||||
- "二等座"
|
- "二等座"
|
||||||
- "一等座"
|
- "一等座"
|
||||||
is_more_ticket: Ture
|
is_more_ticket: True
|
||||||
ticke_peoples:
|
ticke_peoples:
|
||||||
- "文贤平"
|
- "文贤平"
|
||||||
- "梁敏"
|
- "梁敏"
|
||||||
|
@ -47,10 +48,11 @@ set:
|
||||||
- uesr: "@qq.com"
|
- uesr: "@qq.com"
|
||||||
- pwd: "QWERTY"
|
- pwd: "QWERTY"
|
||||||
|
|
||||||
select_refresh_interval: 1
|
select_refresh_interval: 0.01
|
||||||
expect_refresh_interval: 1
|
expect_refresh_interval: 1
|
||||||
ticket_black_list_time: 3
|
ticket_black_list_time: 3
|
||||||
is_aotu_code: False
|
is_aotu_code: False
|
||||||
|
#enable_proxy: False
|
||||||
|
|
||||||
damatu:
|
damatu:
|
||||||
uesr: ""
|
uesr: ""
|
||||||
|
|
|
@ -18,8 +18,8 @@ def md5(byte): # md5加密byte
|
||||||
|
|
||||||
|
|
||||||
class DamatuApi():
|
class DamatuApi():
|
||||||
ID = '53330'
|
ID = '40838'
|
||||||
KEY = '9e5dd939b00d7473c2fa8c1283baa306'
|
KEY = 'ca9507e17e8d5ddf7c57cd18d8d33010'
|
||||||
HOST = 'http://api.dama2.com:7766/app/'
|
HOST = 'http://api.dama2.com:7766/app/'
|
||||||
|
|
||||||
def __init__(self, username, password, file_path):
|
def __init__(self, username, password, file_path):
|
||||||
|
@ -110,8 +110,8 @@ class DamatuApi():
|
||||||
def main(self):
|
def main(self):
|
||||||
balance = self.getBalance()
|
balance = self.getBalance()
|
||||||
if int(balance) > 40:
|
if int(balance) > 40:
|
||||||
result=self.decode(287)
|
result = self.decode(287)
|
||||||
img_code = result.replace('|', ',') if not isinstance(result,int) else ''
|
img_code = result.replace('|', ',') if not isinstance(result, int) else ""
|
||||||
return img_code
|
return img_code
|
||||||
else:
|
else:
|
||||||
raise balanceException('余额不足,当前余额为: {}'.format(balance))
|
raise balanceException('余额不足,当前余额为: {}'.format(balance))
|
||||||
|
|
|
@ -42,7 +42,7 @@ class select:
|
||||||
to_station = ticket_info_config["set"]["to_station"].encode("utf8")
|
to_station = ticket_info_config["set"]["to_station"].encode("utf8")
|
||||||
station_date = ticket_info_config["set"]["station_date"].encode("utf8")
|
station_date = ticket_info_config["set"]["station_date"].encode("utf8")
|
||||||
set_type = ticket_info_config["set"]["set_type"]
|
set_type = ticket_info_config["set"]["set_type"]
|
||||||
is_more_ticket = ticket_info_config["set"]["is_more_ticket"].encode("utf8")
|
is_more_ticket = ticket_info_config["set"]["is_more_ticket"]
|
||||||
ticke_peoples = ticket_info_config["set"]["ticke_peoples"]
|
ticke_peoples = ticket_info_config["set"]["ticke_peoples"]
|
||||||
select_refresh_interval = ticket_info_config["select_refresh_interval"]
|
select_refresh_interval = ticket_info_config["select_refresh_interval"]
|
||||||
station_trains = ticket_info_config["set"]["station_trains"]
|
station_trains = ticket_info_config["set"]["station_trains"]
|
||||||
|
@ -225,8 +225,8 @@ class select:
|
||||||
# tiket_values = [k for k in value['map'].values()]
|
# tiket_values = [k for k in value['map'].values()]
|
||||||
self.secretStr = ticket_info[0]
|
self.secretStr = ticket_info[0]
|
||||||
train_no = ticket_info[3]
|
train_no = ticket_info[3]
|
||||||
# print ('车次: ' + train_no + ' 始发车站: ' + self.from_station + ' 终点站: ' +
|
print ('车次: ' + train_no + ' 始发车站: ' + self.from_station + ' 终点站: ' +
|
||||||
# self.to_station + ' ' + self._station_seat[j].encode("utf8") + ':' + ticket_info[self.station_seat(self._station_seat[j].encode("utf8"))])
|
self.to_station + ' ' + self._station_seat[j].encode("utf8") + ':' + ticket_info[self.station_seat(self._station_seat[j].encode("utf8"))])
|
||||||
if self.ticket_black_list.has_key(train_no) and (datetime.datetime.now() - self.ticket_black_list[train_no]).seconds/60 < int(self.ticket_black_list_time):
|
if self.ticket_black_list.has_key(train_no) and (datetime.datetime.now() - self.ticket_black_list[train_no]).seconds/60 < int(self.ticket_black_list_time):
|
||||||
print("该车次{} 正在被关小黑屋,跳过此车次".format(train_no))
|
print("该车次{} 正在被关小黑屋,跳过此车次".format(train_no))
|
||||||
break
|
break
|
||||||
|
@ -242,11 +242,9 @@ class select:
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
print "当前车次{0} 查询无符合条件坐席,正在重新查询".format(ticket_info[3])
|
print "当前车次{0} 查询无符合条件坐席,正在重新查询".format(ticket_info[3])
|
||||||
# elif ticket_info[11] == "N":
|
else:
|
||||||
# print("当前车次{0} 无票".format(ticket_info[3]))
|
print("当前车次{0} 还处于待售状态,请耐心等待".format(ticket_info[3]))
|
||||||
# else:
|
time.sleep(self.expect_refresh_interval)
|
||||||
# print("当前这次还处于待售状态,请耐心等待")
|
|
||||||
# time.sleep(self.expect_refresh_interval)
|
|
||||||
else:
|
else:
|
||||||
raise ticketConfigException("车次配置信息有误,请检查")
|
raise ticketConfigException("车次配置信息有误,请检查")
|
||||||
|
|
||||||
|
@ -592,20 +590,16 @@ class select:
|
||||||
from_station, to_station = self.station_table(self.from_station, self.to_station)
|
from_station, to_station = self.station_table(self.from_station, self.to_station)
|
||||||
if self.leftTicketLog(from_station, to_station):
|
if self.leftTicketLog(from_station, to_station):
|
||||||
num = 1
|
num = 1
|
||||||
runedTime=0
|
|
||||||
while 1:
|
while 1:
|
||||||
try:
|
try:
|
||||||
num += 1
|
num += 1
|
||||||
sleepTime=self.select_refresh_interval*1000-runedTime
|
time.sleep(self.select_refresh_interval)
|
||||||
if sleepTime>0:
|
|
||||||
time.sleep(sleepTime/1000.0)
|
|
||||||
if time.strftime('%H:%M:%S', time.localtime(time.time())) > "23:00:00":
|
if time.strftime('%H:%M:%S', time.localtime(time.time())) > "23:00:00":
|
||||||
print "12306休息时间,本程序自动停止,明天早上七点运行"
|
print "12306休息时间,本程序自动停止,明天早上七点运行"
|
||||||
break
|
break
|
||||||
start_time = datetime.datetime.now()
|
start_time = datetime.datetime.now()
|
||||||
self.submitOrderRequest(from_station, to_station)
|
self.submitOrderRequest(from_station, to_station)
|
||||||
runedTime=(datetime.datetime.now()-start_time).microseconds/1000
|
print "正在第{0}次查询 乘车日期: {1}, 总耗时{2}ms".format(num, self.station_date, (datetime.datetime.now()-start_time).microseconds/1000)
|
||||||
print "正在第{0}次查询 乘车日期: {1}, 总耗时{2}ms".format(num, self.station_date, runedTime)
|
|
||||||
except PassengerUserException as e:
|
except PassengerUserException as e:
|
||||||
print e.message
|
print e.message
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue