From 94e141429324c989f2b1d77dbd6dcc116dc119ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=87=E8=B4=A4=E5=B9=B3?= Date: Sat, 31 Aug 2019 15:38:02 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=B8=8D=E8=83=BD=E4=B8=8B=E5=8D=95?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + config/ticket_config.yaml | 43 ++++++++++++++++++++++--------------- init/login.py | 14 ++++++------ inter/CheckOrderInfo.py | 6 +++--- inter/GetPassengerDTOs.py | 4 ++-- inter/GetQueueCountAsync.py | 2 +- 6 files changed, 41 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index d78a6d5..3ff2ada 100755 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ *.yaml *.log .idea/ +*.h5 diff --git a/config/ticket_config.yaml b/config/ticket_config.yaml index 63f415b..2b36211 100755 --- a/config/ticket_config.yaml +++ b/config/ticket_config.yaml @@ -5,11 +5,11 @@ set: # - 2018-01-06 # - 2018-01-07 station_dates: - - "2019-01-18" + - "2019-09-28" # 是否根据时间范围 和 乘车类型 购票 # 否则将需要手动填写车次 - is_by_time: False + is_by_time: True # 列车类型: 高铁 G 动车 D 其它火车 O train_types: [G,D,O] @@ -30,15 +30,13 @@ set: # - "G1353" # - "G1329" station_trains: - - "G6153" - - "G6184" - - "G6173" + - "G1690" # 出发城市,比如深圳北,就填深圳就搜得到 - from_station: "邵阳" + from_station: "上饶" # 到达城市 比如深圳北,就填深圳就搜得到 - to_station: "深圳北" + to_station: "上海虹桥" # 座位(list) 多个座位ex: # - "商务座" @@ -64,7 +62,7 @@ set: # 12306登录账号(list) 12306account: - - user: "qqxin1011" + - user: "" - pwd: "" # 加入小黑屋时间默认为5分钟,此功能为了防止僵尸票导致一直下单不成功错过正常的票, @@ -76,11 +74,6 @@ is_auto_code: True # 打码平台, 2 为若快平台(目前只支持若快平台打码,打码兔已经关闭), 若快注册地址:http://www.ruokuai.com/client/index?6726 auto_code_type: 2 -# 打码平台账号 -auto_code_account: - user: "931128603" - pwd: "" - # 邮箱配置,如果抢票成功,将通过邮件配置通知给您 # 列举163 # email: "xxx@163.com" @@ -96,15 +89,15 @@ auto_code_account: # host: "smtp.qq.com" email_conf: is_email: True - email: "931128603@qq.com " - notice_email_list: "931128603@qq.com" - username: "931128603" + email: "" + notice_email_list: "" + username: "" password: "" host: "smtp.qq.com" # 是否开启 pushbear 微信提醒, 使用前需要前往 http://pushbear.ftqq.com 扫码绑定获取 send_key 并关注获得抢票结果通知的公众号 pushbear_conf: - is_pushbear: False + is_pushbear: True send_key: "" # 是否开启cdn查询,可以更快的检测票票 1为开启,2为关闭 @@ -128,4 +121,20 @@ open_time: '13:00:00' # 3、开启代理ip is_proxy: 0 +# 路由器自动切换ip, 目前只支持tplink, +# is_router: 0表示打开,1表示开启 +# router_time: 以/分钟为单位 +#router_pwd: 路由器登录的密码 +#broadband_user_name: 宽带账号 +#broadband_pwd: 宽带密码 + +#is_router: 1 +#router_time: +#router_pwd: +#broadband_user_name: "" +#broadband_pwd: + +# query线程 +#query_thread: 3 + diff --git a/init/login.py b/init/login.py index 0a1a743..5d6a6ab 100755 --- a/init/login.py +++ b/init/login.py @@ -56,7 +56,7 @@ class GoLogin: fresult = self.session.httpClint.send(codeCheckUrl) fresult = eval(fresult.split("(")[1].split(")")[0]) if "result_code" in fresult and fresult["result_code"] == "4": - print (u"验证码通过,开始登录..") + print(u"验证码通过,开始登录..") return True else: if "result_message" in fresult: @@ -81,7 +81,7 @@ class GoLogin: tresult = self.session.httpClint.send(logurl, loginData) if 'result_code' in tresult and tresult["result_code"] == 0: - print (u"登录成功") + print(u"登录成功") tk = self.auth() if "newapptk" in tk and tk["newapptk"]: return tk["newapptk"] @@ -92,8 +92,8 @@ class GoLogin: if messages.find(u"密码输入错误") is not -1: raise UserPasswordException("{0}".format(messages)) else: - print (u"登录失败: {0}".format(messages)) - print (u"尝试重新登陆") + print(u"登录失败: {0}".format(messages)) + print(u"尝试重新登陆") return False else: return False @@ -138,7 +138,9 @@ class GoLogin: devicesIdUrl = copy.deepcopy(self.session.urls["getDevicesId"]) devicesIdUrl["req_url"] = devicesIdUrl["req_url"].format(int(time.time() * 1000)) devicesIdRsp = self.session.httpClint.send(devicesIdUrl) - devicesId = eval(devicesIdRsp.split("(")[1].split(")")[0].replace("'", ""))["dfp"] + # devicesId = eval(devicesIdRsp.split("(")[1].split(")")[0].replace("'", ""))["dfp"] + devicesId = "UysLb2cYwsVjyInSzZ0pGOmYplvokmhBjoGNjrinquaUD0id7gkifgF6FvM2TRCL7Df89GZL1lVV763tGhiPhxlNdlE7iQkk496KUGCFZyyWxE4d0XjyHYv9DlsXfKTlrd8RBUdYIYjmWBXWMN65ElDQiO_Rnrul" + if devicesId: self.session.httpClint.set_cookies(RAIL_DEVICEID=devicesId) @@ -157,4 +159,4 @@ class GoLogin: else: loginAysnSuggest(self.session, username=user, password=passwd) login_num += 1 - break \ No newline at end of file + break diff --git a/inter/CheckOrderInfo.py b/inter/CheckOrderInfo.py index 7dcb4ab..4a20ef4 100644 --- a/inter/CheckOrderInfo.py +++ b/inter/CheckOrderInfo.py @@ -25,14 +25,14 @@ class checkOrderInfo: :return: """ data = OrderedDict() + data['bed_level_order_num'] = "000000000000000000000000000000" data['passengerTicketStr'] = self.passengerTicketStrList.rstrip("_{0}".format(self.set_type)) data['oldPassengerStr'] = self.oldPassengerStr - data['REPEAT_SUBMIT_TOKEN'] = self.token + data['tour_flag'] = 'dc' data['randCode'] = "" data['cancel_flag'] = 2 - data['bed_level_order_num'] = "000000000000000000000000000000" - data['tour_flag'] = 'dc' data['_json_att'] = "" + data['REPEAT_SUBMIT_TOKEN'] = self.token return data def sendCheckOrderInfo(self): diff --git a/inter/GetPassengerDTOs.py b/inter/GetPassengerDTOs.py index 34edb88..5d90f87 100644 --- a/inter/GetPassengerDTOs.py +++ b/inter/GetPassengerDTOs.py @@ -92,7 +92,7 @@ class getPassengerDTOs: '0,' + user_info[0]['passenger_type'] + "," + user_info[0][ "passenger_name"] + "," + user_info[0]['passenger_id_type_code'] + "," + user_info[0]['passenger_id_no'] + "," + - user_info[0]['mobile_no'] + ',N') + user_info[0]['mobile_no'] + ',N,' + user_info[0]["allEncStr"]) oldPassengerStr.append( user_info[0]['passenger_name'] + "," + user_info[0]['passenger_id_type_code'] + "," + user_info[0]['passenger_id_no'] + "," + user_info[0]['passenger_type'] + '_') @@ -101,7 +101,7 @@ class getPassengerDTOs: passengerTicketStrList.append( '0,' + user_info[i]['passenger_type'] + "," + user_info[i][ "passenger_name"] + "," + user_info[i]['passenger_id_type_code'] + "," + user_info[i][ - 'passenger_id_no'] + "," + user_info[i]['mobile_no'] + ',N_' + set_type) + 'passenger_id_no'] + "," + user_info[i]['mobile_no'] + ',N,' + user_info[i]["allEncStr"] + '_' + set_type) 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'] + '_') diff --git a/inter/GetQueueCountAsync.py b/inter/GetQueueCountAsync.py index e7753b2..50c7682 100644 --- a/inter/GetQueueCountAsync.py +++ b/inter/GetQueueCountAsync.py @@ -1,4 +1,4 @@ -# coding=utf-8 +[]# coding=utf-8 import datetime import sys import time