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
8ed02ea6
Commit
8ed02ea6
authored
Jan 27, 2019
by
Breeze Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
通知消息 增加 乘车人,发车时间、到达时间、账号等信息
parent
9462e0d7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
order_log.py
py12306/log/order_log.py
+11
-6
order.py
py12306/order/order.py
+2
-2
No files found.
py12306/log/order_log.py
View file @
8ed02ea6
...
@@ -31,13 +31,13 @@ class OrderLog(BaseLog):
...
@@ -31,13 +31,13 @@ class OrderLog(BaseLog):
MESSAGE_QUERY_ORDER_WAIT_TIME_INFO
=
'第 {} 次排队,请耐心等待'
MESSAGE_QUERY_ORDER_WAIT_TIME_INFO
=
'第 {} 次排队,请耐心等待'
MESSAGE_ORDER_SUCCESS_NOTIFICATION_TITLE
=
'车票购买成功!'
MESSAGE_ORDER_SUCCESS_NOTIFICATION_TITLE
=
'车票购买成功!'
MESSAGE_ORDER_SUCCESS_NOTIFICATION_CONTENT
=
'请及时登录12306,打开
\'
未完成订单
\'
,在30分钟内完成支付!'
MESSAGE_ORDER_SUCCESS_NOTIFICATION_CONTENT
=
'请及时登录12306
账号[{}]
,打开
\'
未完成订单
\'
,在30分钟内完成支付!'
MESSAGE_ORDER_SUCCESS_NOTIFICATION_INFO
=
'
\t\t
车次信息:
{} -> {} ( {} ),乘车日期 {},席位
:{}'
MESSAGE_ORDER_SUCCESS_NOTIFICATION_INFO
=
'
\t\t
车次信息:
{} {}[{}] -> {}[{}],乘车日期 {},席位:{},乘车人
:{}'
MESSAGE_ORDER_SUCCESS_NOTIFICATION_OF_VOICE_CODE_START_SEND
=
'正在发送语音通知...'
MESSAGE_ORDER_SUCCESS_NOTIFICATION_OF_VOICE_CODE_START_SEND
=
'正在发送语音通知...'
MESSAGE_ORDER_SUCCESS_NOTIFICATION_OF_VOICE_CODE_CONTENT
=
'你的车票 {} 到 {} 购买成功,请登录 12306 进行支付'
MESSAGE_ORDER_SUCCESS_NOTIFICATION_OF_VOICE_CODE_CONTENT
=
'你的车票 {} 到 {} 购买成功,请登录 12306 进行支付'
MESSAGE_ORDER_SUCCESS_NOTIFICATION_OF_EMAIL_CONTENT
=
'订单号 {},请及时登录12306,打开
\'
未完成订单
\'
,在30分钟内完成支付!'
MESSAGE_ORDER_SUCCESS_NOTIFICATION_OF_EMAIL_CONTENT
=
'订单号 {},请及时登录12306
账号[{}]
,打开
\'
未完成订单
\'
,在30分钟内完成支付!'
MESSAGE_JOB_CLOSED
=
'当前任务已结束'
MESSAGE_JOB_CLOSED
=
'当前任务已结束'
...
@@ -60,8 +60,13 @@ class OrderLog(BaseLog):
...
@@ -60,8 +60,13 @@ class OrderLog(BaseLog):
def
get_order_success_notification_info
(
cls
,
query
):
def
get_order_success_notification_info
(
cls
,
query
):
from
py12306.query.job
import
Job
from
py12306.query.job
import
Job
assert
isinstance
(
query
,
Job
)
assert
isinstance
(
query
,
Job
)
return
cls
.
MESSAGE_ORDER_SUCCESS_NOTIFICATION_INFO
.
format
(
query
.
get_info_of_left_station
(),
passengers
=
[
passenger
.
get
(
'name'
)
+
'('
+
passenger
.
get
(
'type_text'
)
+
')'
for
passenger
in
query
.
passengers
]
return
cls
.
MESSAGE_ORDER_SUCCESS_NOTIFICATION_INFO
.
format
(
query
.
get_info_of_train_number
(),
query
.
get_info_of_left_station
(),
query
.
get_info_of_train_left_time
(),
query
.
get_info_of_arrive_station
(),
query
.
get_info_of_arrive_station
(),
query
.
get_info_of_train_
number
(),
query
.
get_info_of_train_
arrive_time
(),
query
.
get_info_of_left_date
(),
query
.
get_info_of_left_date
(),
query
.
current_seat_name
)
query
.
current_seat_name
,
','
.
join
(
passengers
))
py12306/order/order.py
View file @
8ed02ea6
...
@@ -77,7 +77,7 @@ class Order:
...
@@ -77,7 +77,7 @@ class Order:
def
order_did_success
(
self
):
def
order_did_success
(
self
):
OrderLog
.
print_ticket_did_ordered
(
self
.
order_id
)
OrderLog
.
print_ticket_did_ordered
(
self
.
order_id
)
OrderLog
.
notification
(
OrderLog
.
MESSAGE_ORDER_SUCCESS_NOTIFICATION_TITLE
,
OrderLog
.
notification
(
OrderLog
.
MESSAGE_ORDER_SUCCESS_NOTIFICATION_TITLE
,
OrderLog
.
MESSAGE_ORDER_SUCCESS_NOTIFICATION_CONTENT
)
OrderLog
.
MESSAGE_ORDER_SUCCESS_NOTIFICATION_CONTENT
.
format
(
self
.
user_ins
.
user_name
)
)
self
.
send_notification
()
self
.
send_notification
()
return
True
return
True
...
@@ -85,7 +85,7 @@ class Order:
...
@@ -85,7 +85,7 @@ class Order:
# num = 0 # 通知次数
# num = 0 # 通知次数
# sustain_time = self.notification_sustain_time
# sustain_time = self.notification_sustain_time
info_message
=
OrderLog
.
get_order_success_notification_info
(
self
.
query_ins
)
info_message
=
OrderLog
.
get_order_success_notification_info
(
self
.
query_ins
)
normal_message
=
OrderLog
.
MESSAGE_ORDER_SUCCESS_NOTIFICATION_OF_EMAIL_CONTENT
.
format
(
self
.
order_id
)
normal_message
=
OrderLog
.
MESSAGE_ORDER_SUCCESS_NOTIFICATION_OF_EMAIL_CONTENT
.
format
(
self
.
order_id
,
self
.
user_ins
.
user_name
)
if
Config
()
.
EMAIL_ENABLED
:
# 邮件通知
if
Config
()
.
EMAIL_ENABLED
:
# 邮件通知
Notification
.
send_email
(
Config
()
.
EMAIL_RECEIVER
,
OrderLog
.
MESSAGE_ORDER_SUCCESS_NOTIFICATION_TITLE
,
Notification
.
send_email
(
Config
()
.
EMAIL_RECEIVER
,
OrderLog
.
MESSAGE_ORDER_SUCCESS_NOTIFICATION_TITLE
,
normal_message
+
info_message
)
normal_message
+
info_message
)
...
...
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