mirror of
https://github.com/PaiGramTeam/Gift-Code-Web.git
synced 2024-11-21 22:58:18 +00:00
🐛 Fix Error UTC Timezone
This commit is contained in:
parent
b673997f95
commit
e6be7a0e61
2
add.py
2
add.py
@ -1,4 +1,5 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from pytz import timezone
|
||||||
from sys import argv
|
from sys import argv
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import List
|
from typing import List
|
||||||
@ -16,6 +17,7 @@ def add(code: str, expire_str: str, rewards_str: List[str]) -> Code:
|
|||||||
else:
|
else:
|
||||||
expire = datetime.strptime(expire_str, "%Y-%m-%d")
|
expire = datetime.strptime(expire_str, "%Y-%m-%d")
|
||||||
expire = expire.replace(hour=23, minute=59, second=59, microsecond=999999)
|
expire = expire.replace(hour=23, minute=59, second=59, microsecond=999999)
|
||||||
|
expire = timezone("Asia/Shanghai").localize(expire)
|
||||||
rewards = []
|
rewards = []
|
||||||
for reward_str in rewards_str:
|
for reward_str in rewards_str:
|
||||||
reward_list = reward_str.split(":")
|
reward_list = reward_str.split(":")
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
"cnt": 60
|
"cnt": 60
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"expire": 1689724799999
|
"expire": 1689695999999
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"code": "9A6BHRKX4XNL",
|
"code": "9A6BHRKX4XNL",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import re
|
import re
|
||||||
|
from pytz import timezone
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
@ -57,6 +58,7 @@ def parse_code(tr: Tag) -> Code:
|
|||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
expire = datetime.strptime(f"{day} {month}", "%d %b")
|
expire = datetime.strptime(f"{day} {month}", "%d %b")
|
||||||
expire = expire.replace(year=now.year, hour=23, minute=59, second=59, microsecond=999999)
|
expire = expire.replace(year=now.year, hour=23, minute=59, second=59, microsecond=999999)
|
||||||
|
expire = timezone("Asia/Shanghai").localize(expire)
|
||||||
expire = int(expire.timestamp() * 1000)
|
expire = int(expire.timestamp() * 1000)
|
||||||
rewards = []
|
rewards = []
|
||||||
for reward in tds[1].find_all("div", {"class": "flex"}):
|
for reward in tds[1].find_all("div", {"class": "flex"}):
|
||||||
|
@ -2,3 +2,4 @@ pydantic
|
|||||||
httpx
|
httpx
|
||||||
beautifulsoup4
|
beautifulsoup4
|
||||||
lxml
|
lxml
|
||||||
|
pytz
|
||||||
|
Loading…
Reference in New Issue
Block a user