更优雅的方案

This commit is contained in:
qwerdvd 2023-08-11 23:07:02 +08:00
parent ad12bbe4e2
commit f04eb222d3

View File

@ -1,11 +1,6 @@
import asyncio
import json
import msgspec
from gsuid_core.data_store import get_res_path
from gsuid_core.utils.error_reply import get_error
from gsuid_core.utils.image.convert import convert_img
from PIL import Image
from msgspec import json as msgjson
from ..utils.ark_api import ark_skd_api
@ -21,5 +16,5 @@ async def get_role_img(sr_uid: str):
player_save_path = get_res_path(['ArknightsUID', 'players'])
with open(player_save_path / f'{uid}.json', 'w', encoding='UTF-8') as f:
json.dump(json.loads(msgspec.json.encode(player_info)), f, ensure_ascii=False, indent=4)
with open(player_save_path / f'{uid}.json', 'wb') as file:
file.write(msgjson.format(msgjson.encode(player_info), indent=4))