From dba8fe0a5394eff5477a93c148bbddaef240eb88 Mon Sep 17 00:00:00 2001 From: "xianping.wen" <931128603@qq.com> Date: Mon, 9 Sep 2019 14:16:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=80=99=E8=A1=A5=E9=80=BB?= =?UTF-8?q?=E8=BE=91=20version=201.1.108?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TickerConfig.py | 16 ++++++---------- Update.md | 3 +++ config/urlConf.py | 11 +++++++++++ init/select_ticket_info.py | 2 +- inter/ConfirmHB.py | 5 +++-- inter/SubmitOrderRequest.py | 6 ++++-- 6 files changed, 28 insertions(+), 15 deletions(-) diff --git a/TickerConfig.py b/TickerConfig.py index eef3c1b..24676fb 100644 --- a/TickerConfig.py +++ b/TickerConfig.py @@ -6,21 +6,17 @@ # 刷票模式:1=刷票 2=候补+刷票 TICKET_TYPE = 2 -# 候补最晚兑现日期,目前软件为捡漏加自动候补,所以这个值一定要填,并且这个日期一定要填小于最长订票时间(30天) -# 格式为日期+小时+分 -# 举例: 比如今天才可以买10.1号的票,比如你那个发车是10.1号上午两点,你兑现时间写到10.1晚上22点? -# t("#fromDate").val() + "#" + t("#dafaultTime").html().replace("时", "") + "#" + t("#dafaultMinutes").html().replace("分", ""), -J_Z_PARAM = "2019-09-28#22#59" - # 出发日期(list) "2018-01-06", "2018-01-07" STATION_DATES = [ - "2019-09-20" + "2019-09-30" ] # 填入需要购买的车次(list),"G1353" STATION_TRAINS = [ "", + "", ] + # 出发城市,比如深圳北,就填深圳就搜得到 FROM_STATION = "" @@ -50,6 +46,7 @@ IS_MORE_TICKET = True # - "李四" TICKET_PEOPLES = [ "", + "", ] # 12306登录账号 @@ -110,11 +107,10 @@ IS_PROXY = 0 # 预售放票时间, 如果是捡漏模式,可以忽略此操作 OPEN_TIME = "13:00:00" - # 1=使用selenium获取devicesID # 2=使用网页端/otn/HttpZF/logdevice获取devicesId,这个接口的算法目前可能有点问题,如果登录一直302的请改为配置1 COOKIE_TYPE = 1 -# 如果COOKIE_TYPE=2,则需配置chromeDriver路径,下载地址http://chromedriver.storage.googleapis.com/index.html +# 如果COOKIE_TYPE=1,则需配置chromeDriver路径,下载地址http://chromedriver.storage.googleapis.com/index.html # chromedriver配置版本只要和chrome的大版本匹配就行 CHROME_PATH = "/Users/wenxianping/Downloads/chromedriver" @@ -131,4 +127,4 @@ PASSENGER_TICKER_STR = { } # 软件版本 -RE_VERSION = "1.1.107" +RE_VERSION = "1.1.108" diff --git a/Update.md b/Update.md index b14e04a..7df673e 100644 --- a/Update.md +++ b/Update.md @@ -177,3 +177,6 @@ - 2019.09.07更新 - 优化候补逻辑 - 去除敏感信息打印 + +- 2019.09.09更新 + - 优化候补逻辑 diff --git a/config/urlConf.py b/config/urlConf.py index bff41ef..efa3e57 100755 --- a/config/urlConf.py +++ b/config/urlConf.py @@ -562,6 +562,17 @@ urls = { "is_logger": True, "is_json": True, }, + "passengerInitApi": { # 排队 + "req_url": "/otn/afterNate/passengerInitApi", + "req_type": "post", + "Referer": "https://kyfw.12306.cn/otn/leftTicket/init", + "Host": "kyfw.12306.cn", + "re_try": 10, + "re_time": 0.01, + "s_time": 0.01, + "is_logger": True, + "is_json": True, + }, diff --git a/init/select_ticket_info.py b/init/select_ticket_info.py index 713678c..61e4f70 100755 --- a/init/select_ticket_info.py +++ b/init/select_ticket_info.py @@ -57,7 +57,7 @@ class select: print(u"*" * 50) print(f"检查当前版本为: {TickerConfig.RE_VERSION}") print(u"检查当前python版本为:{},目前版本只支持3.6以上".format(sys.version.split(" ")[0])) - print(u"12306刷票小助手,最后更新于2019.09.07,请勿作为商业用途,交流群号:" + print(u"12306刷票小助手,最后更新于2019.09.09,请勿作为商业用途,交流群号:" u" 1群:286271084(已满)\n" u" 2群:649992274(已满)\n" u" 3群:632501142(已满)\n" diff --git a/inter/ConfirmHB.py b/inter/ConfirmHB.py index 3dd1c0b..210ce45 100644 --- a/inter/ConfirmHB.py +++ b/inter/ConfirmHB.py @@ -5,7 +5,7 @@ from inter.GetQueueCount import queryQueueByAfterNate class confirmHB: - def __init__(self, secretList, session, tickerNo): + def __init__(self, secretList, session, tickerNo, jzdhDate): """ 人脸识别 """ @@ -13,6 +13,7 @@ class confirmHB: self.session = session self.passengerTicketStrByAfterLate = session.passengerTicketStrByAfterLate self.tickerNo = tickerNo + self.jzdhDate = jzdhDate def data_apr(self): """ @@ -25,7 +26,7 @@ class confirmHB: ticker = TickerConfig.PASSENGER_TICKER_STR.get(TickerConfig.SET_TYPE[0]) data = OrderedDict() data["passengerInfo"] = self.passengerTicketStrByAfterLate - data["jzParam"] = TickerConfig.J_Z_PARAM + data["jzParam"] = self.jzdhDate data["hbTrain"] = f"{self.tickerNo},{ticker}#" data["lkParam"] = "" return data diff --git a/inter/SubmitOrderRequest.py b/inter/SubmitOrderRequest.py index 3206d5a..25ee949 100644 --- a/inter/SubmitOrderRequest.py +++ b/inter/SubmitOrderRequest.py @@ -6,6 +6,7 @@ import TickerConfig from config.urlConf import urls from inter.CheckOrderInfo import checkOrderInfo from inter.ConfirmHB import confirmHB +from inter.PassengerInitApi import passengerInitApi from myException.ticketIsExitsException import ticketIsExitsException @@ -105,5 +106,6 @@ class submitOrderRequestByAfterNate: if not submitOrderRequestRsp.get("status") or not submitOrderRequestRsp.get("data", {}).get("flag"): print("".join(submitOrderRequestRsp.get("messages")) or submitOrderRequestRsp.get("validateMessages")) return - confirm = confirmHB(self.secretList, self.session, self.tickerNo) - confirm.sendChechFace() + pApi = passengerInitApi(self.session, self.secretList, self.tickerNo) + pApi.sendPassengerInitApi() +