diff --git a/.github/workflows/add.yml b/.github/workflows/add.yml index be5cf59..b70a5d9 100644 --- a/.github/workflows/add.yml +++ b/.github/workflows/add.yml @@ -12,7 +12,7 @@ on: description: 'gift code' required: true expire: - description: 'expire date, format: 2023-6-10' + description: 'expire date, format: 2023-6-10 or 2023-06-10:12:00:00' required: true rewards: description: 'rewards, format: 星琼:60 信用点:1000' diff --git a/add.py b/add.py index 08180b7..3d8e5bf 100644 --- a/add.py +++ b/add.py @@ -10,8 +10,12 @@ custom_path = data_path / "custom.json" def add(code: str, expire_str: str, rewards_str: List[str]) -> Code: - expire = datetime.strptime(expire_str, "%Y-%m-%d") - expire = expire.replace(hour=23, minute=59, second=59, microsecond=999999) + if ":" in expire_str: + expire = datetime.strptime(expire_str, "%Y-%m-%d:%H:%M:%S") + expire = expire.replace(microsecond=999999) + else: + expire = datetime.strptime(expire_str, "%Y-%m-%d") + expire = expire.replace(hour=23, minute=59, second=59, microsecond=999999) rewards = [] for reward_str in rewards_str: reward_list = reward_str.split(":") diff --git a/data/custom.json b/data/custom.json index 9a6823e..e3ddcdd 100644 --- a/data/custom.json +++ b/data/custom.json @@ -9,6 +9,114 @@ } ], "expire": 1689724799999 + }, + { + "code": "9A6BHRKX4XNL", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "信用点", + "cnt": 50000 + } + ], + "expire": 1685160000999 + }, + { + "code": "5S6BZ93E4WN8", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "漫游指南", + "cnt": 5 + } + ], + "expire": 1685160000999 + }, + { + "code": "TTNAYQ3FMF9U", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "提纯以太", + "cnt": 4 + } + ], + "expire": 1685160000999 + }, + { + "code": "SSNAG9JX5ENU", + "reward": [ + { + "name": "信用点", + "cnt": 5000 + }, + { + "name": "冒险记录", + "cnt": 3 + }, + { + "name": "凝缩以太", + "cnt": 2 + }, + { + "name": "大宇宙炒饭", + "cnt": 3 + } + ], + "expire": 1683475199999 + }, + { + "code": "MB6SZQJX5E6Y", + "reward": [ + { + "name": "星琼", + "cnt": 300 + }, + { + "name": "信用点", + "cnt": 50000 + }, + { + "name": "漫游指南", + "cnt": 5 + }, + { + "name": "提纯以太", + "cnt": 4 + } + ], + "expire": 1682870399999 + }, + { + "code": "SR8888", + "reward": [ + { + "name": "星琼", + "cnt": 50 + }, + { + "name": "信用点", + "cnt": 10000 + }, + { + "name": "漫游指南", + "cnt": 3 + }, + { + "name": "提纯以太", + "cnt": 3 + } + ], + "expire": 1682870399999 } ], "over": []