调整网站服务时间

网站服务时间以调整为:”全天提供信息查询及退票服务,每日5:00至次日1:00(周二为5:00至23:30)提供售票改签服务“

见 [互联网购票须知](https://kyfw.12306.cn/otn/gonggao/saleTicketMeans.html?toservicetime&linktypeid=means3)

Signed-off-by: Gardel <sunxinao@hotmail.com>
This commit is contained in:
Gardel
2021-09-25 17:39:36 +08:00
parent f7c8ff4daa
commit c98c423c5e
2 changed files with 7 additions and 5 deletions

View File

@@ -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

View File

@@ -32,7 +32,7 @@ class User:
@classmethod
def run(cls):
self = cls()
app_available_check()
# app_available_check() 用户系统不休息
self.start()
pass