Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
janlyn06
12306
提交
c4806e63
1
12306
项目概览
janlyn06
/
12306
通知
4
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
1
12306
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c4806e63
编写于
1月 10, 2018
作者:
W
wenxianping
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化查询逻辑
上级
f53270c1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
12 deletion
+12
-12
init/select_ticket_info.py
init/select_ticket_info.py
+12
-12
tkcode
tkcode
+0
-0
未找到文件。
init/select_ticket_info.py
浏览文件 @
c4806e63
...
...
@@ -241,10 +241,9 @@ class select:
break
else
:
pass
print
"当前车次{0} 查询无符合条件坐席,正在重新查询"
.
format
(
ticket_info
[
3
])
else
:
time
.
sleep
(
self
.
expect_refresh_interval
)
pass
time
.
sleep
(
self
.
expect_refresh_interval
)
else
:
raise
ticketConfigException
(
"车次配置信息有误,请检查"
)
...
...
@@ -438,7 +437,7 @@ class select:
if
self
.
checkQueueOrder
():
return
True
else
:
print
(
"当前排队人数:"
+
str
(
countT
)
+
"当前余票还剩余:{} 张,继续排队中"
.
format
(
ticket_split
))
print
(
"当前排队人数:"
+
str
(
countT
)
+
"当前余票还剩余:{
0
} 张,继续排队中"
.
format
(
ticket_split
))
else
:
print
(
"排队发现未知错误{0},将此列车 {1}加入小黑屋"
.
format
(
getQueueCountResult
,
train_no
))
self
.
ticket_black_list
[
train_no
]
=
datetime
.
datetime
.
now
()
...
...
@@ -490,9 +489,9 @@ class select:
elif
"messages"
in
checkQueueOrderResult
and
checkQueueOrderResult
[
"messages"
]:
print
(
"提交订单失败,错误信息: "
+
checkQueueOrderResult
[
"messages"
])
else
:
print
(
"
订单提交
中,请耐心等待:"
+
str
(
checkQueueOrderResult
[
"validateMessages"
]))
print
(
"
提交订单
中,请耐心等待:"
+
str
(
checkQueueOrderResult
[
"validateMessages"
]))
else
:
print
(
"接口 {} 无响应"
.
format
(
"confirmSingleForQueue"
))
print
(
"接口 {} 无响应"
.
format
(
checkQueueOrderUrl
))
def
queryOrderWaitTime
(
self
):
"""
...
...
@@ -523,20 +522,21 @@ class select:
print
queryOrderWaitTimeResult
[
"data"
][
"msg"
]
break
elif
"waitTime"
in
queryOrderWaitTimeResult
[
"data"
]
and
queryOrderWaitTimeResult
[
"data"
][
"waitTime"
]:
print
(
"排队等待时间预计还剩
{}"
.
format
(
queryOrderWaitTimeResult
[
"data"
][
"waitTime"
]))
print
(
"排队等待时间预计还剩
{0} ms"
.
format
(
0
-
queryOrderWaitTimeResult
[
"data"
][
"waitTime"
]))
else
:
print
(
"正在等待中"
)
elif
"messages"
in
queryOrderWaitTimeResult
and
queryOrderWaitTimeResult
[
"messages"
]:
print
(
"
订单提交
失败: "
+
queryOrderWaitTimeResult
[
"messages"
])
print
(
"
排队等待
失败: "
+
queryOrderWaitTimeResult
[
"messages"
])
else
:
print
(
"
订单提交中,请耐心等待"
)
print
(
"
第{}排队中,请耐心等待"
.
format
(
num
)
)
time
.
sleep
(
2
)
else
:
print
(
"接口 {} 无响应"
.
format
(
"queryOrderWaitTime"
))
print
(
"接口 {} 无响应"
.
format
(
queryOrderWaitTimeUrl
))
order_id
=
self
.
queryMyOrderNoComplete
()
# 尝试查看订单列表,如果有订单,则判断成功,不过一般可能性不大
if
order_id
:
raise
ticketIsExitsException
(
"恭喜您订票成功,订单号为:{0}, 请立即打开浏览器登录12306,访问‘未完成订单’,在30分钟内完成支付!"
.
format
(
order_id
))
raise
ticketNumOutException
(
"订单提交失败!"
)
else
:
print
(
ticketNumOutException
(
"订单提交失败!,正在重新刷票"
))
def
queryMyOrderNoComplete
(
self
):
"""
...
...
@@ -565,7 +565,7 @@ class select:
else
:
return
False
else
:
print
(
"接口 {} 无响应"
.
format
(
"queryMyOrderNoComplete"
))
print
(
"接口 {} 无响应"
.
format
(
queryMyOrderNoCompleteUrl
))
def
initNoComplete
(
self
):
"""
...
...
@@ -601,7 +601,7 @@ class select:
break
start_time
=
datetime
.
datetime
.
now
()
self
.
submitOrderRequest
(
from_station
,
to_station
)
print
"正在第{0}次查询 乘车日期: {1}
查询无票 代理设置无 总耗时{2}ms"
.
format
(
num
,
self
.
station_date
,
(
datetime
.
datetime
.
now
()
-
start_time
).
microseconds
/
1000
)
print
"正在第{0}次查询 乘车日期: {1}
车次{2} 查询 无 票 代理设置 无 总耗时{3}ms"
.
format
(
num
,
self
.
station_date
,
","
.
join
(
self
.
station_trains
)
,
(
datetime
.
datetime
.
now
()
-
start_time
).
microseconds
/
1000
)
except
PassengerUserException
as
e
:
print
e
.
message
break
...
...
tkcode
浏览文件 @
c4806e63
无法预览此类型文件
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录