Add old codes

This commit is contained in:
xtaodada 2023-06-10 22:54:40 +08:00
parent 9469c86160
commit 475e962089
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
3 changed files with 115 additions and 3 deletions

View File

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

8
add.py
View File

@ -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(":")

View File

@ -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": []