Exemplo n.º 1
0
 def _confirm_single_for_queue_asys(self):
     form_data = OrderedDict()
     form_data['passengerTicketStr'] = build_passenger_ticket_string(
         self.seat_type, self.passenger_data)
     form_data['oldPassengerStr'] = build_oldpassenger_ticket_string(
         self.passenger_data)
     form_data['randCode'] = ''
     form_data['purpose_codes'] = find_by_name(
         "ticket", Config.basic_config.ticket_type).sys_code
     form_data['key_check_isChange'] = self.ticket_passenger_info[
         'key_check_isChange']
     form_data['leftTicketStr'] = self.ticket_passenger_info[
         'leftTicketStr']
     form_data['train_location'] = self.ticket_passenger_info[
         'train_location']
     form_data['choose_seats'] = ''
     form_data['seatDetailType'] = ''
     form_data['_json_att'] = ''
     json_response = send_requests(LOGIN_SESSION,
                                   self.URLS['confirmSingleForQueueAsys'],
                                   data=form_data)
     status, msg = submit_response_checker(json_response,
                                           ["status", "data.submitStatus"],
                                           True)
     return status, msg
Exemplo n.º 2
0
 def _auto_submit_order_request(self):
     """
     # response example. for debug.
         {'validateMessagesShowId': '_validatorMessage', 'status': True, 'httpstatus': 200, 'data': {'result': 'QX#F7F13745AA1C7631B9C6B204C3677E3E1B654BE1111F558326BFED9D#hcc983%2Bc27menDVKU5ja2C2Q1%2FbToZXgLI1l8950QBZxtWwE#1', 'ifShowPassCode': 'N', 'canChooseBeds': 'N', 'canChooseSeats': 'Y', 'choose_Seats': 'M9', 'isCanChooseMid': 'N', 'ifShowPassCodeTime': '2985', 'submitStatus': True, 'smokeStr': ''}, 'messages': [], 'validateMessages': {}}
     :return:
     """
     data = OrderedDict()
     data["secretStr"] = self.decode_secret_str(self.train.secretStr.value)
     data["train_date"] = self.format_date(self.train.train_date.value)
     data["tour_flag"] = "dc"
     data["purpose_codes"] = find_by_name(
         "ticket", Config.basic_config.ticket_type).sys_code
     data["query_from_station_name"] = self.train.from_station.value.name
     data["query_to_station_name"] = self.train.to_station.value.name
     data["cancel_flag"] = 2
     data["bed_level_order_num"] = "000000000000000000000000000000"
     data["passengerTicketStr"] = build_passenger_ticket_string(
         self.seat_type, self.passenger_data)
     data["oldPassengerStr"] = build_oldpassenger_ticket_string(
         self.passenger_data)
     json_response = send_requests(LOGIN_SESSION,
                                   self.URLS['autoSubmitOrderRequest'],
                                   data=data)
     status, msg = submit_response_checker(json_response,
                                           ["status", "data.submitStatus"],
                                           True)
     if status:
         self.ticket_passenger_info = dict(
             zip(["train_location", "key_check_isChange", "leftTicketStr"],
                 [
                     unquote(v)
                     for v in json_response["data"]["result"].split("#")
                 ]))
     return status, msg
Exemplo n.º 3
0
 def _auto_submit_order_request(self):
     """
     :return: status, msg
     """
     data = OrderedDict()
     data["secretStr"] = self.decode_secret_str(self.train.secretStr.value)
     data["train_date"] = self.format_date(self.train.train_date.value)
     data["tour_flag"] = "dc"
     data["purpose_codes"] = find_by_name(
         "ticket", Config.basic_config.ticket_type).sys_code
     data["query_from_station_name"] = self.train.from_station.value.name
     data["query_to_station_name"] = self.train.to_station.value.name
     data["cancel_flag"] = 2
     data["bed_level_order_num"] = "000000000000000000000000000000"
     data["passengerTicketStr"] = build_passenger_ticket_string(
         self.seat_type, self.passenger_data)
     data["oldPassengerStr"] = build_oldpassenger_ticket_string(
         self.passenger_data)
     json_response = send_requests(LOGIN_SESSION,
                                   self.URLS['autoSubmitOrderRequest'],
                                   data=data)
     status, msg = submit_response_checker(json_response,
                                           ["status", "data.submitStatus"],
                                           True)
     if status:
         self.ticket_passenger_info = dict(
             zip(["train_location", "key_check_isChange", "leftTicketStr"],
                 [
                     unquote(v)
                     for v in json_response["data"]["result"].split("#")
                 ]))
     return status, msg
Exemplo n.º 4
0
 def _check_order_info(self):
     form_data = {
         'cancel_flag': self.ticket_passenger_info['orderRequestDTO']['cancel_flag'] or '2',
         'bed_level_order_num': self.ticket_passenger_info['orderRequestDTO']['bed_level_order_num'] \
                                or '000000000000000000000000000000',
         'passengerTicketStr': build_passenger_ticket_string(self.seat_type, self.passenger_data),
         'oldPassengerStr': build_oldpassenger_ticket_string(self.passenger_data),
         'tour_flag': self.ticket_passenger_info['tour_flag'] or 'dc',
         'randCode': '',
         'whatsSelect': '1',
         '_json_att': '',
         'REPEAT_SUBMIT_TOKEN': self.token,
     }
     Log.v("正在提交检查订单状态请求")
     json_response = send_requests(LOGIN_SESSION, self.URLS['checkOrderInfo'], data=form_data)
     status, msg = submit_response_checker(json_response, ["status", "data.submitStatus"], True, "校验订单成功")
     return status, msg
Exemplo n.º 5
0
 def _confirm_single_or_go_for_queue(self):
     form_data = {
         'passengerTicketStr':
         build_passenger_ticket_string(self.seat_type, self.passenger_data),
         'oldPassengerStr':
         build_oldpassenger_ticket_string(self.passenger_data),
         'randCode':
         '',
         'purpose_codes':
         self.ticket_passenger_info['purpose_codes'],
         'key_check_isChange':
         self.ticket_passenger_info['key_check_isChange'],
         'leftTicketStr':
         self.ticket_passenger_info['leftTicketStr'],
         'train_location':
         self.ticket_passenger_info['train_location'],
         'choose_seats':
         '',  # 暂时未加选座
         'seatDetailType':
         '000',
         'whatsSelect':
         '1',
         'roomType':
         '00',
         'dwAll':
         'N',
         '_json_att':
         '',
         'REPEAT_SUBMIT_TOKEN':
         self.token,
     }
     Log.v("正在为你请求排队提交订单")
     json_response = send_requests(LOGIN_SESSION,
                                   self.URLS['confirmForQueue'],
                                   data=form_data)
     status, msg = submit_response_checker(json_response,
                                           ["status", "data.submitStatus"],
                                           True, "请求排队成功")
     if not status:
         BlackTrains.add_train(self.train)
     return status, msg