改为自动候补+下单
This commit is contained in:
@@ -62,7 +62,7 @@ class getPassengerDTOs:
|
||||
}
|
||||
return str(passengerTicketStr[set_type.replace(' ', '')])
|
||||
|
||||
def getPassengerTicketStrListAndOldPassengerStr(self):
|
||||
def getPassengerTicketStrListAndOldPassengerStr(self, secretStr, secretList):
|
||||
"""
|
||||
获取提交车次人内容格式
|
||||
passengerTicketStr O,0,1,文贤平,1,43052419950223XXXX,15618715583,N_O,0,1,梁敏,1,43052719920118XXXX,,N
|
||||
@@ -84,7 +84,7 @@ class getPassengerDTOs:
|
||||
raise PassengerUserException(ticket.DTO_NOT_IN_LIST)
|
||||
if len(user_info) < self.is_more_ticket_num: # 如果乘车人填错了导致没有这个乘车人的话,可能乘车人数会小于自动乘车人
|
||||
self.is_more_ticket_num = len(user_info)
|
||||
if TickerConfig.TICKET_TYPE is 1:
|
||||
if secretStr:
|
||||
set_type = self.getPassengerTicketStr(self.set_type)
|
||||
if self.is_more_ticket_num is 1:
|
||||
passengerTicketStrList.append(
|
||||
@@ -104,7 +104,7 @@ class getPassengerDTOs:
|
||||
oldPassengerStr.append(
|
||||
user_info[i]['passenger_name'] + "," + user_info[i]['passenger_id_type_code'] + "," +
|
||||
user_info[i]['passenger_id_no'] + "," + user_info[i]['passenger_type'] + '_')
|
||||
elif TickerConfig.TICKET_TYPE is 2:
|
||||
elif secretList:
|
||||
"""
|
||||
候补订单有多少个联系人,就候补多少个联系人了,没有优先提交之说
|
||||
1#XXXX#1#***************77X#bf6ae40d3655ae7eff005ee21d95876b38ab97a8031b464bc2f74a067e3ec957;
|
||||
|
||||
@@ -77,19 +77,24 @@ class query:
|
||||
if result:
|
||||
for i in value['result']:
|
||||
ticket_info = i.split('|')
|
||||
if TickerConfig.TICKET_TYPE is 2 and self.check_is_need_train(ticket_info):
|
||||
# 如果最后一位为1,则是可以候补的,不知道这些正确嘛?
|
||||
if ticket_info[-2] == "1":
|
||||
print("当前订单可以候补,尝试提交候补订单")
|
||||
return {
|
||||
"secretStr": ticket_info[0],
|
||||
"seat": TickerConfig.SET_TYPE,
|
||||
"status": True,
|
||||
}
|
||||
elif TickerConfig.TICKET_TYPE is 1:
|
||||
if ticket_info[11] == "Y" and ticket_info[1] == "预订": # 筛选未在开始时间内的车次
|
||||
for j in self._station_seat:
|
||||
is_ticket_pass = ticket_info[j]
|
||||
# if TickerConfig.TICKET_TYPE is 2 and self.check_is_need_train(ticket_info):
|
||||
# # 如果最后一位为1,则是可以候补的,不知道这些正确嘛?
|
||||
# if ticket_info[-2] == "1":
|
||||
# nate = list(ticket_info[-1])
|
||||
# for set_type in TickerConfig.SET_TYPE:
|
||||
# if TickerConfig.PASSENGER_TICKER_STR(set_type) not in nate:
|
||||
# continue
|
||||
# print("当前订单可以候补,尝试提交候补订单")
|
||||
# return {
|
||||
# "secretStr": ticket_info[0],
|
||||
# "seat": TickerConfig.SET_TYPE,
|
||||
# "status": True,
|
||||
# }
|
||||
# elif TickerConfig.TICKET_TYPE is 1:
|
||||
if ticket_info[1] == "预订": # 筛选未在开始时间内的车次
|
||||
for j in self._station_seat:
|
||||
is_ticket_pass = ticket_info[j]
|
||||
if ticket_info[11] == "Y":
|
||||
if is_ticket_pass != '' and is_ticket_pass != '无' and is_ticket_pass != '*' and self.check_is_need_train(
|
||||
ticket_info): # 过滤有效目标车次
|
||||
secretStr = ticket_info[0]
|
||||
@@ -144,6 +149,22 @@ class query:
|
||||
"cdn": self.httpClint.cdn,
|
||||
"status": True,
|
||||
}
|
||||
elif is_ticket_pass == '无' and ticket_info[-2] == "1":
|
||||
"""
|
||||
is_ticket_pass如果有别的显示,但是可以候补,可以提issues提出来,附上query log,我将添加上
|
||||
判断车次是否可以候补
|
||||
目前的候补机制是只要一有候补位置,立马提交候补
|
||||
"""
|
||||
# 如果最后一位为1,则是可以候补的,不知道这些正确嘛?
|
||||
nate = list(ticket_info[-1])
|
||||
for set_type in TickerConfig.SET_TYPE:
|
||||
if TickerConfig.PASSENGER_TICKER_STR[set_type] not in nate:
|
||||
print(f"当前订单可以候补,候补位置为: {set_type}, 尝试提交候补订单")
|
||||
return {
|
||||
"secretList": ticket_info[0],
|
||||
"seat": [set_type],
|
||||
"status": True,
|
||||
}
|
||||
else:
|
||||
print(u"车次配置信息有误,或者返回数据异常,请检查 {}".format(station_ticket))
|
||||
return {"code": ticket.FAIL_CODE, "status": False, "cdn": self.httpClint.cdn, }
|
||||
|
||||
Reference in New Issue
Block a user