调整网站服务时间
网站服务时间以调整为:”全天提供信息查询及退票服务,每日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:
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class User:
|
||||
@classmethod
|
||||
def run(cls):
|
||||
self = cls()
|
||||
app_available_check()
|
||||
# app_available_check() 用户系统不休息
|
||||
self.start()
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user