mirror of
https://github.com/KimigaiiWuyi/GenshinUID.git
synced 2025-05-31 04:30:29 +08:00
🐛 返回字段错误
This commit is contained in:
parent
34a7497b1d
commit
26acc0850b
@ -16,21 +16,21 @@ INT_TO_TYPE = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async def import_gachalogs(history_url: str, uid: int) -> str:
|
async def import_gachalogs(history_url: str, uid: str) -> str:
|
||||||
history_data: dict = json.loads(get(history_url).text)
|
history_data: dict = json.loads(get(history_url).text)
|
||||||
data_uid = history_data['info']['uid']
|
data_uid = history_data['info']['uid']
|
||||||
if data_uid != str(uid):
|
if data_uid != uid:
|
||||||
return f'该抽卡记录UID{data_uid}与你绑定UID{uid}不符合!'
|
return f'该抽卡记录UID{data_uid}与你绑定UID{uid}不符合!'
|
||||||
raw_data = history_data['list']
|
raw_data = history_data['list']
|
||||||
result = {'新手祈愿': [], '常驻祈愿': [], '角色祈愿': [], '武器祈愿': []}
|
result = {'新手祈愿': [], '常驻祈愿': [], '角色祈愿': [], '武器祈愿': []}
|
||||||
for item in raw_data:
|
for item in raw_data:
|
||||||
result[INT_TO_TYPE[item['gacha_type']]].append(item)
|
result[INT_TO_TYPE[item['gacha_type']]].append(item)
|
||||||
im = await save_gachalogs(str(uid), result)
|
im = await save_gachalogs(uid, result)
|
||||||
return im
|
return im
|
||||||
|
|
||||||
|
|
||||||
async def export_gachalogs(uid: int) -> dict:
|
async def export_gachalogs(uid: str) -> dict:
|
||||||
path = PLAYER_PATH / str(uid)
|
path = PLAYER_PATH / uid
|
||||||
if not path.exists():
|
if not path.exists():
|
||||||
path.mkdir(parents=True, exist_ok=True)
|
path.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ async def export_gachalogs(uid: int) -> dict:
|
|||||||
raw_data = json.load(f)
|
raw_data = json.load(f)
|
||||||
result = {
|
result = {
|
||||||
'info': {
|
'info': {
|
||||||
'uid': str(uid),
|
'uid': uid,
|
||||||
'lang': 'zh-cn',
|
'lang': 'zh-cn',
|
||||||
'export_time': current_time,
|
'export_time': current_time,
|
||||||
'export_app': 'GenshinUID',
|
'export_app': 'GenshinUID',
|
||||||
@ -59,17 +59,19 @@ async def export_gachalogs(uid: int) -> dict:
|
|||||||
item['uigf_gacha_type'] = item['gacha_type']
|
item['uigf_gacha_type'] = item['gacha_type']
|
||||||
result['list'].append(item)
|
result['list'].append(item)
|
||||||
# 保存文件
|
# 保存文件
|
||||||
with open(path / f'UIGF_{str(uid)}', 'w', encoding='UTF-8') as file:
|
with open(path / f'UIGF_{uid}.json', 'w', encoding='UTF-8') as file:
|
||||||
json.dump(result, file, ensure_ascii=False)
|
json.dump(result, file, ensure_ascii=False)
|
||||||
im = {
|
im = {
|
||||||
'retcode': 'ok',
|
'retcode': 'ok',
|
||||||
'data': '导出成功!',
|
'data': '导出成功!',
|
||||||
'url': str(path / f'UIGF_{str(uid)}'),
|
'name': f'UIGF_{uid}.json',
|
||||||
|
'url': str(path / f'UIGF_{uid}.json'),
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
im = {
|
im = {
|
||||||
'retcode': 'error',
|
'retcode': 'error',
|
||||||
'data': '你还没有抽卡记录可以导出!',
|
'data': '你还没有抽卡记录可以导出!',
|
||||||
|
'name': '',
|
||||||
'url': '',
|
'url': '',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user