mirror of
https://github.com/baiqwerdvd/ArknightsUID.git
synced 2025-05-08 13:06:03 +08:00
✨ Add error_reply
This commit is contained in:
parent
056c0ea799
commit
ef3067955c
@ -181,23 +181,12 @@ class BaseArkApi:
|
|||||||
unpack_data = self.unpack(raw_data)
|
unpack_data = self.unpack(raw_data)
|
||||||
return msgspec.convert(unpack_data, type=ArknightsUserMeModel)
|
return msgspec.convert(unpack_data, type=ArknightsUserMeModel)
|
||||||
|
|
||||||
# async def check_code_valid(self, code: str) -> bool | str:
|
|
||||||
# data = {
|
|
||||||
# 'kind': 1,
|
|
||||||
# 'code': code
|
|
||||||
# }
|
|
||||||
# raw_data = await self.ark_request(
|
|
||||||
# ARK_GEN_CRED_BY_CODE,
|
|
||||||
# data=data
|
|
||||||
# )
|
|
||||||
# if isinstance(raw_data, int):
|
|
||||||
# return False
|
|
||||||
# else:
|
|
||||||
# cred = raw_data['cred']
|
|
||||||
# return cred
|
|
||||||
|
|
||||||
def unpack(self, raw_data: dict) -> dict:
|
def unpack(self, raw_data: dict) -> dict:
|
||||||
return raw_data['data']
|
try:
|
||||||
|
data = raw_data['data']
|
||||||
|
return data
|
||||||
|
except KeyError:
|
||||||
|
return raw_data
|
||||||
|
|
||||||
async def refresh_token(self, cred: str, uid: str | None = None) -> str:
|
async def refresh_token(self, cred: str, uid: str | None = None) -> str:
|
||||||
header = deepcopy(_HEADER)
|
header = deepcopy(_HEADER)
|
||||||
@ -321,12 +310,18 @@ class BaseArkApi:
|
|||||||
logger.info(raw_data)
|
logger.info(raw_data)
|
||||||
|
|
||||||
# 判断code
|
# 判断code
|
||||||
if 'code' in raw_data and raw_data['code'] == 10000:
|
if raw_data['code'] == 0:
|
||||||
#token失效
|
return raw_data
|
||||||
|
|
||||||
|
if raw_data['code'] == 10000:
|
||||||
|
# token失效
|
||||||
logger.info(f'{url} {raw_data}')
|
logger.info(f'{url} {raw_data}')
|
||||||
raise TokenExpiredError
|
raise TokenExpiredError
|
||||||
|
|
||||||
return raw_data
|
if raw_data['code'] == 10001:
|
||||||
|
# 重复签到
|
||||||
|
return raw_data['code']
|
||||||
|
|
||||||
# 判断status
|
# 判断status
|
||||||
# if 'status' in raw_data and 'msg' in raw_data:
|
# if 'status' in raw_data and 'msg' in raw_data:
|
||||||
# retcode = 1
|
# retcode = 1
|
||||||
|
@ -1,16 +1,10 @@
|
|||||||
UID_HINT = '添加失败, 请先绑定明日方舟UID'
|
UID_HINT = '添加失败, 请先绑定明日方舟UID'
|
||||||
|
|
||||||
def get_error(retcode: int | str) -> str:
|
def get_error(retcode: int | str) -> str:
|
||||||
|
if retcode == 10000:
|
||||||
|
return '请求异常, 请检查具体实现代码...'
|
||||||
if retcode == 10001:
|
if retcode == 10001:
|
||||||
return '请求体出错, 请检查具体实现代码...'
|
return '请勿重复签到!'
|
||||||
if retcode == -10001:
|
if retcode == 10003:
|
||||||
return '请求体出错, 请检查具体实现代码...'
|
return '请勿修改设备时间'
|
||||||
if retcode == -201:
|
|
||||||
return '你的账号可能已被封禁, 请联系米游社客服...'
|
|
||||||
if retcode == -501101:
|
|
||||||
return '当前角色冒险等阶未达到10级, 暂时无法参加此活动...'
|
|
||||||
if retcode == 400:
|
|
||||||
return '[MINIGG]暂未找到此内容...'
|
|
||||||
if retcode == -400:
|
|
||||||
return '请输入更详细的名称...'
|
|
||||||
return f'API报错, 错误码为{retcode}!'
|
return f'API报错, 错误码为{retcode}!'
|
Loading…
x
Reference in New Issue
Block a user