Skip to content

Commit

Permalink
修改部分提示信息,以及提示逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
versionzhang committed Apr 4, 2019
1 parent 82e6541 commit d298a6b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion python12306/__version__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__title__ = 'py12306'
__version__ = '0.9.2'
__version__ = '0.9.4'
__author__ = 'versionzhang'
__author_email__ = 'versionzhang@gmail.com'
__url__ = 'https://github.com/versionzhang/python_12306'
Expand Down
5 changes: 2 additions & 3 deletions python12306/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ def submit_order(self, data):

def notice_user(self):
if self.order_id:
Log.v("抢票成功,{notice}".format(
notice="你已开启邮箱配置,稍后会收到邮件通知" if Config.email_notice_enable else "如需邮件通知请先配置"))
Log.v("车票信息:")
for order_ticket in self.order_tickets:
print(order_ticket)
Expand Down Expand Up @@ -185,6 +183,7 @@ def heart_beat_mode(self):
self.online_checker_now()

def run(self):
self.maintain_mode()
status = self.pre_check()
if not status:
return
Expand All @@ -207,8 +206,8 @@ def run(self):
n = datetime.datetime.now()
data = DispatcherTool.run(query_params)
count += 1
self.submit_order(data)
DispatcherTool.output_delta_time(n)
self.submit_order(data)
if self.order_id or self.unfinished_order:
break
if self.order_id or self.unfinished_order:
Expand Down
3 changes: 2 additions & 1 deletion python12306/threadscheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ class Schedule(BaseSchedule):
def batch_tasks(self, query_data):
n = datetime.datetime.now()
data = DispatcherTool.run(query_data)
DispatcherTool.output_delta_time(n)
self.submit_order(data)
if self.order_id:
self.pool.close()
DispatcherTool.output_delta_time(n)

def run(self):
self.maintain_mode()
self.pre_check()
while True:
self.maintain_mode()
Expand Down
5 changes: 5 additions & 0 deletions python12306/utils/notice.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def send_weixin(self, msg_type, **extra_var):
if not Config.weixin_notice_enable:
Log.v("未开启微信通知")
return
Log.v("{notice}".format(
notice="你已开启微信通知,稍后会收到推送"))
url = "https://sc.ftqq.com/{key}.send".format(key=Config.weixin_sckey)
data = MESSAGES[msg_type]
subject = data["subject"]
Expand All @@ -69,7 +71,10 @@ def send_email(self, msg_type, **extra_var):
if not Config.email_notice_enable:
Log.v("未开启邮箱通知")
else:
Log.v("{notice}".format(
notice="你已开启邮件通知,稍后会收到邮件"))
data = MESSAGES[msg_type]
Log.v("正在发送邮件...")
try:
sender = email_conf.from_email
receiver = email_conf.notice_email_list
Expand Down

0 comments on commit d298a6b

Please sign in to comment.