Skip to content

Commit

Permalink
1、增加快速订票流程接口
Browse files Browse the repository at this point in the history
2、尝试解决慢排队
  • Loading branch information
testerSunshine committed Jun 11, 2018
1 parent f86f7b9 commit b88d541
Show file tree
Hide file tree
Showing 48 changed files with 1,116 additions and 72 deletions.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified .idea/dictionaries/wenxianping.xml
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified __init__.py
100644 → 100755
Empty file.
Empty file modified agency/__init__.py
100644 → 100755
Empty file.
Empty file modified agency/agency_tools.py
100644 → 100755
Empty file.
Empty file modified agency/cdn_utils.py
100644 → 100755
Empty file.
Empty file modified cdn_list
100644 → 100755
Empty file.
35 changes: 35 additions & 0 deletions config/TicketEnmu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# coding=utf-8


class ticket(object):
QUERY_C = u"查询到有余票,尝试提交订单"
QUERY_IN_BLACK_LIST = u"该车次{} 正在被关小黑屋,跳过此车次"

SUCCESS_CODE = 000000
FAIL_CODE = 999999
AUTO_SUBMIT_ORDER_REQUEST_C = u"提交订单成功"
AUTO_SUBMIT_ORDER_REQUEST_F = u"提交订单失败,重新刷票中"
AUTO_SUBMIT_NEED_CODE = u"需要验证码"
AUTO_SUBMIT_NOT_NEED_CODE = u"不需要验证码"

TICKET_BLACK_LIST_TIME = 5 # 加入小黑屋的等待时间,默认5 min

DTO_NOT_FOUND = u"未查找到常用联系人"
DTO_NOT_IN_LIST = u"联系人不在列表中,请查证后添加"

QUEUE_TICKET_SHORT = u"当前余票数小于乘车人数,放弃订票"
QUEUE_TICKET_SUCCESS = u"排队成功, 当前余票还剩余: {0}张"
QUEUE_JOIN_BLACK = u"排队发现未知错误{0},将此列车 {1}加入小黑屋"
QUEUE_WARNING_MSG = u"排队异常,错误信息:{0}, 将此列车 {1}加入小黑屋"

OUT_NUM = 30 # 排队请求12306的次数
WAIT_OUT_NUM = u"超出排队时间,自动放弃,正在重新刷票"
WAIT_ORDER_SUCCESS = u"恭喜您订票成功,订单号为:{0}, 请立即打开浏览器登录12306,访问‘未完成订单’,在30分钟内完成支付!"
WAIT_ORDER_CONTINUE = u"排队等待时间预计还剩 {0} ms"
WAIT_ORDER_FAIL = u"排队等待失败,错误消息:{0}"
WAIT_ORDER_NUM = u"第{0}次排队中,请耐心等待"
WAIT_ORDER_SUB_FAIL = u"订单提交失败!,正在重新刷票"

CANCEL_ORDER_SUCCESS = u"排队超时,已为您自动取消订单,订单编号: {0}"
CANCEL_ORDER_FAIL = u"排队超时,取消订单失败, 订单号{0}"

Empty file modified config/__init__.py
100644 → 100755
Empty file.
Empty file modified config/configCommon.py
100644 → 100755
Empty file.
Empty file modified config/emailConf.py
100644 → 100755
Empty file.
Empty file modified config/logger.py
100644 → 100755
Empty file.
Empty file modified config/ticketConf.py
100644 → 100755
Empty file.
8 changes: 4 additions & 4 deletions config/ticket_config.yaml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@

set:
station_dates:
- "2018-03-19"
# - "2018-02-21"
- "2018-06-21"
- "2018-06-22"

station_trains:
- "G4831"
- "G1321"

from_station: "上海"
to_station: "长沙"
Expand All @@ -60,7 +60,7 @@ set:
12306count:
# - uesr: ""
# - pwd: "apple1995"
- uesr: "@qq.com"
- uesr: "931128603@qq.com"
- pwd: "QWERTY"

select_refresh_interval: 1
Expand Down
88 changes: 55 additions & 33 deletions config/urlConf.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,54 +1,72 @@
# coding=utf-8
import random

import time

urls = {
"auth": {
"auth": { # 登录接口
"req_url": "/passport/web/auth/uamtk",
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/passport?redirect=/otn/login/userLogin",
"Host": "kyfw.12306.cn",
"Content-Type": 1,
"re_try": 10,
"re_time": 0.1,
"s_time": 0.1,
"is_logger": True,
"is_json": True,
},
"login": {
"login": { # 登录接口
"req_url": "/passport/web/login",
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/login/init",
"Host": "kyfw.12306.cn",
"Content-Type": 1,
"re_try": 10,
"re_time": 0.1,
"s_time": 0.1,
"is_logger": True,
"is_json": True,

},
"getCodeImg": {
"left_ticket_init": { # 登录接口
"req_url": "/otn/leftTicket/init",
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/login/init",
"Host": "kyfw.12306.cn",
"Content-Type": 1,
"re_try": 10,
"re_time": 0.1,
"s_time": 0.1,
"is_logger": False,
"is_json": False,

},
"getCodeImg": { # 登录验证码
"req_url": "/passport/captcha/captcha-image?login_site=E&module=login&rand=sjrand&{0}",
"req_type": "get",
"Referer": "https://kyfw.12306.cn/otn/login/init",
"Host": "kyfw.12306.cn",
"Content-Type": 1,
"re_try": 10,
"re_time": 0.1,
"s_time": 0.1,
"is_logger": False,
"is_json": False,
},
"codeCheck": {
"codeCheck": { # 验证码校验
"req_url": "/passport/captcha/captcha-check",
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/login/init",
"Host": "kyfw.12306.cn",
"Content-Type": 1,
"re_try": 10,
"re_time": 0.1,
"s_time": 0.1,
"is_logger": True,
"is_json": True,
},
"loginInit": {
"loginInit": { # 登录页面
"req_url": "/otn/login/init",
"req_type": "get",
"Referer": "https://kyfw.12306.cn/otn/index/init",
Expand All @@ -59,7 +77,7 @@
"is_logger": False,
"is_json": False,
},
"getUserInfo": {
"getUserInfo": { # 获取用户信息
"req_url": "/otn/index/initMy12306",
"req_type": "get",
"Referer": "https://kyfw.12306.cn/otn/passport?redirect=/otn/login/userLogin",
Expand All @@ -70,7 +88,7 @@
"is_logger": False,
"is_json": False,
},
"userLogin": {
"userLogin": { # 用户登录
"req_url": "/otn/login/userLogin",
"req_type": "get",
"Referer": "https://kyfw.12306.cn/otn/passport?redirect=/otn/login/userLogin",
Expand All @@ -81,18 +99,19 @@
"is_logger": True,
"is_json": True,
},
"uamauthclient": {
"uamauthclient": { # 登录
"req_url": "/otn/uamauthclient",
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/passport?redirect=/otn/login/userLogin",
"Host": "kyfw.12306.cn",
"Content-Type": 1,
"re_try": 10,
"re_time": 0.1,
"s_time": 0.1,
"is_logger": True,
"is_json": True,
},
"initdc_url": {
"initdc_url": { # 生成订单页面
"req_url": "/otn/confirmPassenger/initDc",
"req_type": "get",
"Referer": "https://kyfw.12306.cn/otn/leftTicket/init",
Expand All @@ -103,7 +122,7 @@
"is_logger": False,
"is_json": False,
},
"GetJS": {
"GetJS": { # 订单页面js
"req_url": "/otn/HttpZF/GetJS",
"req_type": "get",
"Referer": "https://kyfw.12306.cn/otn/confirmPassenger/initDc",
Expand All @@ -114,7 +133,7 @@
"is_logger": False,
"is_json": False,
},
"odxmfwg": {
"odxmfwg": { # 订单页面js
"req_url": "/otn/dynamicJs/odxmfwg",
"req_type": "get",
"Referer": "https://kyfw.12306.cn/otn/confirmPassenger/initDc",
Expand All @@ -125,7 +144,7 @@
"is_logger": False,
"is_json": False,
},
"get_passengerDTOs": {
"get_passengerDTOs": { # 获取乘车人
"req_url": "/otn/confirmPassenger/getPassengerDTOs",
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/confirmPassenger/initDc",
Expand All @@ -136,8 +155,8 @@
"is_logger": True,
"is_json": True,
},
"select_url": {
"req_url": "/otn/leftTicket/queryO?leftTicketDTO.train_date={0}&leftTicketDTO.from_station={1}&leftTicketDTO.to_station={2}&purpose_codes=ADULT",
"select_url": { # 查询余票
"req_url": "/otn/leftTicket/query?leftTicketDTO.train_date={0}&leftTicketDTO.from_station={1}&leftTicketDTO.to_station={2}&purpose_codes=ADULT",
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/leftTicket/init",
"Host": "kyfw.12306.cn",
Expand All @@ -147,7 +166,7 @@
"is_logger": False,
"is_json": True,
},
"check_user_url": {
"check_user_url": { # 检查用户登录
"req_url": "/otn/login/checkUser",
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/leftTicket/init",
Expand All @@ -158,7 +177,7 @@
"is_logger": True,
"is_json": True,
},
"submit_station_url": {
"submit_station_url": { # 提交订单
"req_url": "/otn/leftTicket/submitOrderRequest",
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/leftTicket/init",
Expand All @@ -169,7 +188,7 @@
"is_logger": True,
"is_json": True,
},
"checkOrderInfoUrl": {
"checkOrderInfoUrl": { # 检查订单信息规范
"req_url": "/otn/confirmPassenger/checkOrderInfo",
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/confirmPassenger/initDc",
Expand All @@ -180,7 +199,7 @@
"is_logger": True,
"is_json": True,
},
"getQueueCountUrl": {
"getQueueCountUrl": { # 剩余余票数
"req_url": "/otn/confirmPassenger/getQueueCount",
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/confirmPassenger/initDc",
Expand All @@ -191,7 +210,7 @@
"is_logger": True,
"is_json": True,
},
"checkQueueOrderUrl": {
"checkQueueOrderUrl": { # 订单队列排队
"req_url": "/otn/confirmPassenger/confirmSingleForQueue",
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/confirmPassenger/initDc",
Expand All @@ -202,7 +221,7 @@
"is_logger": True,
"is_json": True,
},
"checkRandCodeAnsyn": {
"checkRandCodeAnsyn": { # 暂时没用到
"req_url": "/otn/passcodeNew/checkRandCodeAnsyn",
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/confirmPassenger/initDc",
Expand All @@ -213,7 +232,7 @@
"is_logger": True,
"is_json": True,
},
"codeImgByOrder": {
"codeImgByOrder": { # 订单页面验证码
"req_url": "/otn/passcodeNew/getPassCodeNew?module=passenger&rand=randp&%s" % random.random(),
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/confirmPassenger/initDc",
Expand All @@ -224,9 +243,9 @@
"is_logger": False,
"is_json": False,
},
"queryOrderWaitTimeUrl": {
"req_url": "/otn/confirmPassenger/queryOrderWaitTime",
"req_type": "post",
"queryOrderWaitTimeUrl": { # 订单等待页面
"req_url": "/otn/confirmPassenger/queryOrderWaitTime?random={0}&tourFlag=dc&_json_att=",
"req_type": "get",
"Referer": "https://kyfw.12306.cn/otn/confirmPassenger/initDc",
"Host": "kyfw.12306.cn",
"re_try": 10,
Expand All @@ -235,7 +254,7 @@
"is_logger": True,
"is_json": True,
},
"queryMyOrderNoCompleteUrl": {
"queryMyOrderNoCompleteUrl": { # 订单查询页面
"req_url": "/otn/queryOrder/queryMyOrderNoComplete",
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/queryOrder/initNoComplete",
Expand All @@ -246,7 +265,7 @@
"is_logger": True,
"is_json": True,
},
"initNoCompleteUrl": {
"initNoCompleteUrl": { # 获取订单列表
"req_url": "/otn/queryOrder/initNoComplete",
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/queryOrder/initNoComplete",
Expand All @@ -257,7 +276,7 @@
"is_logger": True,
"is_json": True,
},
"cancelNoCompleteMyOrder": {
"cancelNoCompleteMyOrder": { # 取消订单
"req_url": "/otn/queryOrder/cancelNoCompleteMyOrder",
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/queryOrder/initNoComplete",
Expand All @@ -268,32 +287,35 @@
"is_logger": True,
"is_json": True,
},
"autoSubmitOrderRequest": {
"autoSubmitOrderRequest": { # 快速自动提交订单
"req_url": "/otn/confirmPassenger/autoSubmitOrderRequest",
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/queryOrder/initNoComplete",
"Referer": "https://kyfw.12306.cn/otn/leftTicket/init",
"Host": "kyfw.12306.cn",
"Content-Type": 1,
"re_try": 10,
"re_time": 0.1,
"s_time": 0.1,
"is_logger": True,
"is_json": True,
},
"getQueueCountAsync": {
"getQueueCountAsync": { # 快速获取订单数据
"req_url": "/otn/confirmPassenger/getQueueCountAsync",
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/queryOrder/initNoComplete",
"Referer": "https://kyfw.12306.cn/otn/leftTicket/init",
"Host": "kyfw.12306.cn",
"Content-Type": 1,
"re_try": 10,
"re_time": 0.1,
"s_time": 0.1,
"is_logger": True,
"is_json": True,
},
"confirmSingleForQueueAsys": {
"confirmSingleForQueueAsys": { # 快速订单排队
"req_url": "/otn/confirmPassenger/confirmSingleForQueueAsys",
"req_type": "post",
"Referer": "https://kyfw.12306.cn/otn/queryOrder/initNoComplete",
"Referer": "https://kyfw.12306.cn/otn/leftTicket/init",
"Content-Type": 1,
"Host": "kyfw.12306.cn",
"re_try": 10,
"re_time": 0.1,
Expand Down
Empty file modified damatuCode/__init__.py
100644 → 100755
Empty file.
Empty file modified damatuCode/damatuWeb.py
100644 → 100755
Empty file.
Empty file modified damatuCode/ruokuai.py
100644 → 100755
Empty file.
Loading

0 comments on commit b88d541

Please sign in to comment.