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
d4e1ef10
Commit
d4e1ef10
authored
Jan 16, 2019
by
Jalin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化错误输出
parent
033c34e0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
5 deletions
+6
-5
OCR.py
py12306/helpers/OCR.py
+1
-1
order.py
py12306/order/order.py
+2
-2
job.py
py12306/user/job.py
+3
-2
No files found.
py12306/helpers/OCR.py
View file @
d4e1ef10
...
@@ -37,7 +37,7 @@ class OCR:
...
@@ -37,7 +37,7 @@ class OCR:
result
=
rc
.
rk_create
(
img
,
6113
)
result
=
rc
.
rk_create
(
img
,
6113
)
if
"Result"
in
result
:
if
"Result"
in
result
:
return
self
.
get_image_position_by_offset
(
list
(
result
[
'Result'
]))
return
self
.
get_image_position_by_offset
(
list
(
result
[
'Result'
]))
CommonLog
.
print_auto_code_fail
(
result
.
get
(
"Error"
,
'-'
))
CommonLog
.
print_auto_code_fail
(
result
.
get
(
"Error"
,
CommonLog
.
MESSAGE_RESPONSE_EMPTY_ERROR
))
return
None
return
None
def
get_image_position_by_offset
(
self
,
offsets
):
def
get_image_position_by_offset
(
self
,
offsets
):
...
...
py12306/order/order.py
View file @
d4e1ef10
...
@@ -127,7 +127,7 @@ class Order:
...
@@ -127,7 +127,7 @@ class Order:
if
(
str
(
result
.
get
(
'messages'
,
''
))
.
find
(
'未处理'
)
>=
0
):
# 未处理订单
if
(
str
(
result
.
get
(
'messages'
,
''
))
.
find
(
'未处理'
)
>=
0
):
# 未处理订单
stay_second
(
self
.
retry_time
)
stay_second
(
self
.
retry_time
)
OrderLog
.
add_quick_log
(
OrderLog
.
add_quick_log
(
OrderLog
.
MESSAGE_SUBMIT_ORDER_REQUEST_FAIL
.
format
(
result
.
get
(
'messages'
,
'-'
)))
.
flush
()
OrderLog
.
MESSAGE_SUBMIT_ORDER_REQUEST_FAIL
.
format
(
result
.
get
(
'messages'
,
CommonLog
.
MESSAGE_RESPONSE_EMPTY_ERROR
)))
.
flush
()
return
False
return
False
def
check_order_info
(
self
):
def
check_order_info
(
self
):
...
@@ -166,7 +166,7 @@ class Order:
...
@@ -166,7 +166,7 @@ class Order:
else
:
else
:
error
=
CommonLog
.
MESSAGE_API_RESPONSE_CAN_NOT_BE_HANDLE
error
=
CommonLog
.
MESSAGE_API_RESPONSE_CAN_NOT_BE_HANDLE
if
not
result
.
get
(
'data.isNoActive'
):
if
not
result
.
get
(
'data.isNoActive'
):
error
=
result
.
get
(
'data.errMsg'
)
error
=
result
.
get
(
'data.errMsg'
,
CommonLog
.
MESSAGE_RESPONSE_EMPTY_ERROR
)
else
:
else
:
if
result
.
get
(
'data.checkSeatNum'
):
if
result
.
get
(
'data.checkSeatNum'
):
error
=
'无法提交您的订单! '
+
result
.
get
(
'data.errMsg'
)
error
=
'无法提交您的订单! '
+
result
.
get
(
'data.errMsg'
)
...
...
py12306/user/job.py
View file @
d4e1ef10
...
@@ -13,6 +13,7 @@ from py12306.helpers.request import Request
...
@@ -13,6 +13,7 @@ from py12306.helpers.request import Request
from
py12306.helpers.type
import
UserType
from
py12306.helpers.type
import
UserType
from
py12306.log.order_log
import
OrderLog
from
py12306.log.order_log
import
OrderLog
from
py12306.log.user_log
import
UserLog
from
py12306.log.user_log
import
UserLog
from
py12306.log.common_log
import
CommonLog
class
UserJob
:
class
UserJob
:
...
@@ -149,7 +150,7 @@ class UserJob:
...
@@ -149,7 +150,7 @@ class UserJob:
UserLog
.
add_quick_log
(
UserLog
.
MESSAGE_LOGIN_FAIL
.
format
(
result
.
get
(
'result_message'
)))
.
flush
()
UserLog
.
add_quick_log
(
UserLog
.
MESSAGE_LOGIN_FAIL
.
format
(
result
.
get
(
'result_message'
)))
.
flush
()
else
:
else
:
UserLog
.
add_quick_log
(
UserLog
.
add_quick_log
(
UserLog
.
MESSAGE_LOGIN_FAIL
.
format
(
result
.
get
(
'result_message'
,
result
.
get
(
'message'
,
'-'
))))
.
flush
()
UserLog
.
MESSAGE_LOGIN_FAIL
.
format
(
result
.
get
(
'result_message'
,
result
.
get
(
'message'
,
CommonLog
.
MESSAGE_RESPONSE_EMPTY_ERROR
))))
.
flush
()
return
False
return
False
...
@@ -306,7 +307,7 @@ class UserJob:
...
@@ -306,7 +307,7 @@ class UserJob:
return
self
.
passengers
return
self
.
passengers
else
:
else
:
UserLog
.
add_quick_log
(
UserLog
.
add_quick_log
(
UserLog
.
MESSAGE_GET_USER_PASSENGERS_FAIL
.
format
(
result
.
get
(
'messages'
,
'-'
),
self
.
retry_time
))
.
flush
()
UserLog
.
MESSAGE_GET_USER_PASSENGERS_FAIL
.
format
(
result
.
get
(
'messages'
,
CommonLog
.
MESSAGE_RESPONSE_EMPTY_ERROR
),
self
.
retry_time
))
.
flush
()
stay_second
(
self
.
retry_time
)
stay_second
(
self
.
retry_time
)
return
self
.
get_user_passengers
()
return
self
.
get_user_passengers
()
...
...
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