mirror of https://github.com/testerSunshine/12306
1、修改小黑屋逻辑
parent
b88d541f93
commit
009b989a64
|
@ -14,6 +14,7 @@ import collections
|
||||||
|
|
||||||
from agency.cdn_utils import CDNProxy
|
from agency.cdn_utils import CDNProxy
|
||||||
from config import urlConf
|
from config import urlConf
|
||||||
|
from config.TicketEnmu import ticket
|
||||||
from config.emailConf import sendEmail
|
from config.emailConf import sendEmail
|
||||||
from config.ticketConf import _get_yaml
|
from config.ticketConf import _get_yaml
|
||||||
from init import login
|
from init import login
|
||||||
|
@ -53,7 +54,6 @@ class selectFast:
|
||||||
self.cdn_list = []
|
self.cdn_list = []
|
||||||
self.is_check_user = dict()
|
self.is_check_user = dict()
|
||||||
self.ticket_black_list = dict()
|
self.ticket_black_list = dict()
|
||||||
self.black_train_no = ""
|
|
||||||
self.passengerTicketStrList = ""
|
self.passengerTicketStrList = ""
|
||||||
self.oldPassengerStr = ""
|
self.oldPassengerStr = ""
|
||||||
|
|
||||||
|
@ -176,10 +176,8 @@ class selectFast:
|
||||||
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,)
|
||||||
black_train_no=self.black_train_no)
|
|
||||||
queryResult = q.sendQuery()
|
queryResult = q.sendQuery()
|
||||||
self.black_train_no = "" # 重置小黑屋名单
|
|
||||||
# 查询接口
|
# 查询接口
|
||||||
if queryResult.get("status", False):
|
if queryResult.get("status", False):
|
||||||
secretStr = queryResult.get("secretStr", "")
|
secretStr = queryResult.get("secretStr", "")
|
||||||
|
@ -193,7 +191,7 @@ class selectFast:
|
||||||
if self.ticket_black_list.has_key(train_no) and (
|
if self.ticket_black_list.has_key(train_no) and (
|
||||||
datetime.datetime.now() - self.ticket_black_list[train_no]).seconds / 60 < int(
|
datetime.datetime.now() - self.ticket_black_list[train_no]).seconds / 60 < int(
|
||||||
self.ticket_black_list_time):
|
self.ticket_black_list_time):
|
||||||
print(u"该车次{} 正在被关小黑屋,跳过此车次".format(train_no))
|
print(ticket.QUEUE_WARNING_MSG.format(train_no))
|
||||||
else:
|
else:
|
||||||
# 获取联系人
|
# 获取联系人
|
||||||
if not self.passengerTicketStrList and not self.oldPassengerStr:
|
if not self.passengerTicketStrList and not self.oldPassengerStr:
|
||||||
|
@ -229,7 +227,8 @@ class selectFast:
|
||||||
getQueueCountAsyncResult = g.sendGetQueueCountAsync()
|
getQueueCountAsyncResult = g.sendGetQueueCountAsync()
|
||||||
time.sleep(submitResult.get("ifShowPassCodeTime", 1))
|
time.sleep(submitResult.get("ifShowPassCodeTime", 1))
|
||||||
if getQueueCountAsyncResult.get("is_black", False):
|
if getQueueCountAsyncResult.get("is_black", False):
|
||||||
self.black_train_no = getQueueCountAsyncResult.get("train_no", "")
|
black_train_no = getQueueCountAsyncResult.get("train_no", "")
|
||||||
|
self.ticket_black_list[black_train_no] = datetime.datetime.now()
|
||||||
if getQueueCountAsyncResult.get("status", False):
|
if getQueueCountAsyncResult.get("status", False):
|
||||||
# 请求订单快读接口
|
# 请求订单快读接口
|
||||||
c = confirmSingleForQueueAsys(session=self,
|
c = confirmSingleForQueueAsys(session=self,
|
||||||
|
|
|
@ -13,7 +13,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,
|
||||||
black_train_no, station_dates=None, ):
|
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
|
||||||
|
@ -23,7 +23,6 @@ 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.black_train_no = black_train_no
|
|
||||||
|
|
||||||
def station_seat(self, index):
|
def station_seat(self, index):
|
||||||
"""
|
"""
|
||||||
|
@ -46,8 +45,7 @@ class query:
|
||||||
查询
|
查询
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
if self.black_train_no:
|
|
||||||
self.ticket_black_list[self.black_train_no] = datetime.datetime.now()
|
|
||||||
for station_date in self.station_dates:
|
for station_date in self.station_dates:
|
||||||
select_url = copy.copy(self.session.urls["select_url"])
|
select_url = copy.copy(self.session.urls["select_url"])
|
||||||
select_url["req_url"] = select_url["req_url"].format(
|
select_url["req_url"] = select_url["req_url"].format(
|
||||||
|
|
Loading…
Reference in New Issue