Spaces:
Runtime error
Runtime error
jiarongqiu commited on
Commit ·
480d732
1
Parent(s): 3fdc088
fix
Browse files- util/schema.py +8 -0
- util/time.py +13 -8
util/schema.py
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
|
|
| 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
class Card:
|
| 4 |
|
|
|
|
| 1 |
+
from enum import Enum
|
| 2 |
|
| 3 |
+
class Dir(Enum):
|
| 4 |
+
URL = (1, 'url')
|
| 5 |
+
API = (2, 'api')
|
| 6 |
+
|
| 7 |
+
def __init__(self, id, path):
|
| 8 |
+
self.id = id
|
| 9 |
+
self.path = path
|
| 10 |
|
| 11 |
class Card:
|
| 12 |
|
util/time.py
CHANGED
|
@@ -4,19 +4,24 @@ from datetime import datetime,timedelta
|
|
| 4 |
|
| 5 |
class TimeUtil:
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
@staticmethod
|
| 8 |
def get_date(offset=None):
|
| 9 |
-
|
| 10 |
-
time = datetime.now(beijing_tz)
|
| 11 |
if offset:
|
| 12 |
time = time +timedelta(days=offset)
|
| 13 |
-
format_date = time.strftime('%Y
|
| 14 |
return format_date
|
| 15 |
|
| 16 |
@staticmethod
|
| 17 |
def get_time():
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
return format_time
|
| 22 |
-
|
|
|
|
| 4 |
|
| 5 |
class TimeUtil:
|
| 6 |
|
| 7 |
+
TIMEZONE = 'Asia/Shanghai'
|
| 8 |
+
|
| 9 |
+
@staticmethod
|
| 10 |
+
def get_current_time():
|
| 11 |
+
tz = pytz.timezone('Asia/Shanghai')
|
| 12 |
+
time = datetime.now(tz)
|
| 13 |
+
return time
|
| 14 |
+
|
| 15 |
@staticmethod
|
| 16 |
def get_date(offset=None):
|
| 17 |
+
time = TimeUtil.get_current_time()
|
|
|
|
| 18 |
if offset:
|
| 19 |
time = time +timedelta(days=offset)
|
| 20 |
+
format_date = time.strftime('%Y%m%d')
|
| 21 |
return format_date
|
| 22 |
|
| 23 |
@staticmethod
|
| 24 |
def get_time():
|
| 25 |
+
time = TimeUtil.get_current_time()
|
| 26 |
+
format_time = time.strftime('%Y%m%d %H:%M:%S')
|
| 27 |
+
return format_time
|
|
|
|
|
|