From c98c423c5e59745f4af41f632225a9d0bc8a5560 Mon Sep 17 00:00:00 2001 From: Gardel Date: Sat, 25 Sep 2021 17:39:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=BD=91=E7=AB=99=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 网站服务时间以调整为:”全天提供信息查询及退票服务,每日5:00至次日1:00(周二为5:00至23:30)提供售票改签服务“ 见 [互联网购票须知](https://kyfw.12306.cn/otn/gonggao/saleTicketMeans.html?toservicetime&linktypeid=means3) Signed-off-by: Gardel --- py12306/app.py | 10 ++++++---- py12306/user/user.py | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) 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