mirror of
https://github.com/KimigaiiWuyi/GenshinUID.git
synced 2025-05-07 04:03:45 +08:00
🐛 修复已知问题
This commit is contained in:
parent
5107fc4a09
commit
8129cf66bc
@ -30,7 +30,7 @@ async def send_abyss_info(bot: Bot, ev: Event):
|
||||
)
|
||||
else:
|
||||
floor = ev.text
|
||||
if floor is not None:
|
||||
if floor:
|
||||
floor = int(floor)
|
||||
|
||||
await bot.logger.info('[查询深渊信息]深渊层数: {}'.format(floor))
|
||||
|
@ -3,7 +3,7 @@ from typing import Dict, Tuple, Union, Literal
|
||||
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
from ..utils.mys_api import mys_api
|
||||
from ..utils.convert import GsCookie
|
||||
from ..utils.image.convert import convert_img
|
||||
from ..utils.map.GS_MAP_PATH import avatarId2Name
|
||||
from ..gsuid_utils.api.mys.models import IndexData
|
||||
@ -67,8 +67,12 @@ async def draw_explora_img(
|
||||
|
||||
async def get_base_data(uid: str) -> Union[str, IndexData]:
|
||||
# 获取Cookies
|
||||
raw_data = await mys_api.get_info(uid)
|
||||
if isinstance(raw_data, int):
|
||||
data_def = GsCookie()
|
||||
retcode = await data_def.get_cookie(uid)
|
||||
if retcode:
|
||||
return retcode
|
||||
raw_data = data_def.raw_data
|
||||
if raw_data is None:
|
||||
return '数据异常!'
|
||||
return raw_data
|
||||
|
||||
|
@ -36,7 +36,7 @@ async def set_config_func(
|
||||
bot_id: str,
|
||||
config_name: str = '',
|
||||
uid: str = '0',
|
||||
user_id: Optional[str] = None,
|
||||
user_id: str = '',
|
||||
option: str = '0',
|
||||
query: Optional[bool] = None,
|
||||
is_admin: bool = False,
|
||||
@ -57,7 +57,6 @@ async def set_config_func(
|
||||
await sqla.update_user_data(
|
||||
uid,
|
||||
{
|
||||
'user_id': user_id,
|
||||
f'{PRIV_MAP[config_name]}_switch': option,
|
||||
},
|
||||
)
|
||||
|
@ -7,7 +7,7 @@ from .draw_gcginfo import draw_gcg_info
|
||||
from ..utils.error_reply import UID_HINT
|
||||
|
||||
|
||||
@SV('查询七圣').on_command(('七圣召唤', '七圣', 'qszh'))
|
||||
@SV('查询七圣').on_command(('七圣召唤', 'qszh'))
|
||||
async def send_gcg_pic(bot: Bot, ev: Event):
|
||||
uid = await get_uid(bot, ev)
|
||||
if uid is None:
|
||||
|
@ -183,19 +183,21 @@ class SQLA:
|
||||
await self.session.commit()
|
||||
return True
|
||||
|
||||
async def update_user_data(self, user_id: str, data: Optional[Dict]):
|
||||
async def update_user_data(self, uid: str, data: Optional[Dict]):
|
||||
sql = update(GsUser).where(
|
||||
GsUser.user_id == user_id and GsUser.bot_id == self.bot_id
|
||||
GsUser.uid == uid and GsUser.bot_id == self.bot_id
|
||||
)
|
||||
if data is not None:
|
||||
query = sql.values(**data)
|
||||
query.execution_options(synchronize_session='fetch')
|
||||
await self.session.execute(query)
|
||||
await self.session.commit()
|
||||
|
||||
async def delete_user_data(self, uid: str):
|
||||
if await self.user_exists(uid):
|
||||
sql = delete(GsUser).where(GsUser.uid == uid)
|
||||
await self.session.execute(sql)
|
||||
await self.session.commit()
|
||||
return True
|
||||
return False
|
||||
|
||||
@ -208,10 +210,12 @@ class SQLA:
|
||||
empty_sql = delete(GsCache)
|
||||
await self.session.execute(sql)
|
||||
await self.session.execute(empty_sql)
|
||||
await self.session.commit()
|
||||
|
||||
async def mark_invalid(self, cookie: str, mark: str):
|
||||
sql = update(GsUser).where(GsUser.cookie == cookie).values(status=mark)
|
||||
await self.session.execute(sql)
|
||||
await self.session.commit()
|
||||
|
||||
async def user_exists(self, uid: str) -> bool:
|
||||
data = await self.select_user_data(uid)
|
||||
|
Loading…
x
Reference in New Issue
Block a user