diff --git a/py12306/app.py b/py12306/app.py index c7bcf03..7fa5ebf 100644 --- a/py12306/app.py +++ b/py12306/app.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -import os import signal import sys @@ -11,16 +10,19 @@ from py12306.log.order_log import OrderLog def app_available_check(): - # return True # Debug if Config().IS_DEBUG: return True now = time_now() - if (now.hour >= 23 and now.minute >= 30) or now.hour < 6: + if now.weekday() == 1 and (now.hour > 23 and now.minute > 30 or now.hour < 5): CommonLog.add_quick_log(CommonLog.MESSAGE_12306_IS_CLOSED.format(time_now())).flush() - open_time = datetime.datetime(now.year, now.month, now.day, 6) + open_time = datetime.datetime(now.year, now.month, now.day, 5) if open_time < now: open_time += datetime.timedelta(1) sleep((open_time - now).seconds) + elif 1 < now.hour < 5: + CommonLog.add_quick_log(CommonLog.MESSAGE_12306_IS_CLOSED.format(time_now())).flush() + open_time = datetime.datetime(now.year, now.month, now.day, 5) + sleep((open_time - now).seconds) return True diff --git a/py12306/user/user.py b/py12306/user/user.py index 4d749f7..e7b9127 100644 --- a/py12306/user/user.py +++ b/py12306/user/user.py @@ -32,7 +32,7 @@ class User: @classmethod def run(cls): self = cls() - app_available_check() + # app_available_check() 用户系统不休息 self.start() pass