Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
py12306
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
python
py12306
Commits
696f888a
Commit
696f888a
authored
Jan 25, 2019
by
Jalin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化避免无座检测逻辑
parent
68445e19
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
order_log.py
py12306/log/order_log.py
+3
-1
order.py
py12306/order/order.py
+4
-1
No files found.
py12306/log/order_log.py
View file @
696f888a
...
...
@@ -17,6 +17,7 @@ class OrderLog(BaseLog):
MESSAGE_CHECK_ORDER_INFO_SUCCESS
=
'检查订单成功'
MESSAGE_GET_QUEUE_INFO_SUCCESS
=
'获取排队信息成功,目前排队人数 {}, 余票还剩余 {} 张'
MESSAGE_GET_QUEUE_INFO_NO_SEAT
=
'接口返回实际为无票,跳过本次排队'
MESSAGE_GET_QUEUE_COUNT_SUCCESS
=
'排队成功,你当前排在第 {} 位, 余票还剩余 {} 张'
MESSAGE_GET_QUEUE_LESS_TICKET
=
'排队失败,目前排队人数已经超过余票张数'
MESSAGE_GET_QUEUE_COUNT_FAIL
=
'排队失败,错误原因 {}'
...
...
@@ -62,4 +63,5 @@ class OrderLog(BaseLog):
return
cls
.
MESSAGE_ORDER_SUCCESS_NOTIFICATION_INFO
.
format
(
query
.
get_info_of_left_station
(),
query
.
get_info_of_arrive_station
(),
query
.
get_info_of_train_number
(),
query
.
get_info_of_left_date
(),
query
.
current_seat_name
)
query
.
get_info_of_left_date
(),
query
.
current_seat_name
)
py12306/order/order.py
View file @
696f888a
...
...
@@ -246,9 +246,12 @@ class Order:
ticket
=
result
.
get
(
'data.ticket'
)
.
split
(
','
)
# 余票列表
# 这里可以判断 是真实是 硬座还是无座,避免自动分配到无座
ticket_number
=
ticket
[
0
]
# 余票
if
ticket_number
!=
'充足'
or
int
(
ticket_number
)
<=
0
:
if
ticket_number
!=
'充足'
and
int
(
ticket_number
)
<=
0
:
if
self
.
query_ins
.
current_seat
==
SeatType
.
NO_SEAT
:
# 允许无座
ticket_number
=
ticket
[
1
]
if
not
int
(
ticket_number
):
# 跳过无座
OrderLog
.
add_quick_log
(
OrderLog
.
MESSAGE_GET_QUEUE_INFO_NO_SEAT
)
.
flush
()
return
False
if
result
.
get
(
'data.op_2'
)
==
'true'
:
OrderLog
.
add_quick_log
(
OrderLog
.
MESSAGE_GET_QUEUE_LESS_TICKET
)
.
flush
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment