mirror of https://github.com/testerSunshine/12306
修正余票小于乘客人数,则不提交
parent
2e023aebba
commit
2d85ef1994
|
@ -183,7 +183,8 @@ class select:
|
||||||
to_station_h=self.to_station,
|
to_station_h=self.to_station,
|
||||||
_station_seat=self._station_seat,
|
_station_seat=self._station_seat,
|
||||||
station_trains=self.station_trains,
|
station_trains=self.station_trains,
|
||||||
station_dates=self.station_dates, )
|
station_dates=self.station_dates,
|
||||||
|
ticke_peoples_num=len(from_station),)
|
||||||
queryResult = q.sendQuery()
|
queryResult = q.sendQuery()
|
||||||
# 查询接口
|
# 查询接口
|
||||||
if queryResult.get("status", False):
|
if queryResult.get("status", False):
|
||||||
|
|
|
@ -45,7 +45,8 @@ class checkOrderInfo:
|
||||||
CheckOrderInfoUrls = self.session.urls["checkOrderInfoUrl"]
|
CheckOrderInfoUrls = self.session.urls["checkOrderInfoUrl"]
|
||||||
data = self.data_par()
|
data = self.data_par()
|
||||||
checkOrderInfoRep = self.session.httpClint.send(CheckOrderInfoUrls, data)
|
checkOrderInfoRep = self.session.httpClint.send(CheckOrderInfoUrls, data)
|
||||||
if 'data' in checkOrderInfoRep:
|
data = checkOrderInfoRep.get("data", {})
|
||||||
|
if data and data.get("submitStatus", False):
|
||||||
print (u'车票提交通过,正在尝试排队')
|
print (u'车票提交通过,正在尝试排队')
|
||||||
ifShowPassCodeTime = int(checkOrderInfoRep["data"]["ifShowPassCodeTime"]) / float(1000)
|
ifShowPassCodeTime = int(checkOrderInfoRep["data"]["ifShowPassCodeTime"]) / float(1000)
|
||||||
if "ifShowPassCode" in checkOrderInfoRep["data"] and checkOrderInfoRep["data"]["ifShowPassCode"] == "Y":
|
if "ifShowPassCode" in checkOrderInfoRep["data"] and checkOrderInfoRep["data"]["ifShowPassCode"] == "Y":
|
||||||
|
|
|
@ -11,7 +11,7 @@ class query:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, session, from_station, to_station, from_station_h, to_station_h, _station_seat, station_trains,
|
def __init__(self, session, from_station, to_station, from_station_h, to_station_h, _station_seat, station_trains,
|
||||||
station_dates=None, ):
|
ticke_peoples_num, station_dates=None,):
|
||||||
self.session = session
|
self.session = session
|
||||||
self.from_station = from_station
|
self.from_station = from_station
|
||||||
self.to_station = to_station
|
self.to_station = to_station
|
||||||
|
@ -21,6 +21,7 @@ class query:
|
||||||
self._station_seat = _station_seat if isinstance(_station_seat, list) else list(_station_seat)
|
self._station_seat = _station_seat if isinstance(_station_seat, list) else list(_station_seat)
|
||||||
self.station_dates = station_dates if isinstance(station_dates, list) else list(station_dates)
|
self.station_dates = station_dates if isinstance(station_dates, list) else list(station_dates)
|
||||||
self.ticket_black_list = dict()
|
self.ticket_black_list = dict()
|
||||||
|
self.ticke_peoples_num = ticke_peoples_num
|
||||||
|
|
||||||
def station_seat(self, index):
|
def station_seat(self, index):
|
||||||
"""
|
"""
|
||||||
|
@ -74,7 +75,10 @@ class query:
|
||||||
ticket_info[self.station_seat(self._station_seat[j].encode("utf8"))]))
|
ticket_info[self.station_seat(self._station_seat[j].encode("utf8"))]))
|
||||||
if wrapcache.get(train_no):
|
if wrapcache.get(train_no):
|
||||||
print(ticket.QUERY_IN_BLACK_LIST.format(train_no))
|
print(ticket.QUERY_IN_BLACK_LIST.format(train_no))
|
||||||
break
|
continue
|
||||||
|
if self.ticke_peoples_num < int(ticket_info[self.station_seat(self._station_seat[j].encode("utf8"))]):
|
||||||
|
# 小于乘车人数则无视此次乘车机会, 以后可以扩展为有票优先提交
|
||||||
|
continue
|
||||||
else:
|
else:
|
||||||
print (ticket.QUERY_C)
|
print (ticket.QUERY_C)
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue