From 99e09caf24392bda42c9464ae07cb173b50e81e7 Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Sat, 12 Apr 2025 16:10:44 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E6=97=B6=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zhenxun/builtin_plugins/hooks/auth_hook.py | 2 +- zhenxun/builtin_plugins/init/__init_cache.py | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/zhenxun/builtin_plugins/hooks/auth_hook.py b/zhenxun/builtin_plugins/hooks/auth_hook.py index a6cf3c9c..34ea8018 100644 --- a/zhenxun/builtin_plugins/hooks/auth_hook.py +++ b/zhenxun/builtin_plugins/hooks/auth_hook.py @@ -23,7 +23,7 @@ async def _(matcher: Matcher, event: Event, bot: Bot, session: Uninfo, message: session, message, ) - logger.info(f"权限检测耗时:{time.time() - start_time}秒", LOGGER_COMMAND) + logger.debug(f"权限检测耗时:{time.time() - start_time}秒", LOGGER_COMMAND) # 解除命令block阻塞 diff --git a/zhenxun/builtin_plugins/init/__init_cache.py b/zhenxun/builtin_plugins/init/__init_cache.py index 49f84f26..3bb04711 100644 --- a/zhenxun/builtin_plugins/init/__init_cache.py +++ b/zhenxun/builtin_plugins/init/__init_cache.py @@ -100,7 +100,9 @@ async def _(cache_data: CacheData, module: str): @CacheRoot.with_refresh(CacheType.PLUGINS) -async def _(data: dict[str, PluginInfo]): +async def _(data: dict[str, PluginInfo] | None): + if not data: + return plugins = await PluginInfo.filter(module__in=data.keys(), load_status=True).all() for plugin in plugins: data[plugin.module] = plugin @@ -142,7 +144,9 @@ async def _(cache_data: CacheData, group_id: str): @CacheRoot.with_refresh(CacheType.GROUPS) -async def _(data: dict[str, GroupConsole]): +async def _(data: dict[str, GroupConsole] | None): + if not data: + return groups = await GroupConsole.filter( group_id__in=data.keys(), channel_id__isnull=True ).all() @@ -186,7 +190,9 @@ async def _(cache_data: CacheData, bot_id: str): @CacheRoot.with_refresh(CacheType.BOT) -async def _(data: dict[str, BotConsole]): +async def _(data: dict[str, BotConsole] | None): + if not data: + return bots = await BotConsole.filter(bot_id__in=data.keys()).all() for bot in bots: data[bot.bot_id] = bot @@ -228,7 +234,9 @@ async def _(cache_data: CacheData, user_id: str): @CacheRoot.with_refresh(CacheType.USERS) -async def _(data: dict[str, UserConsole]): +async def _(data: dict[str, UserConsole] | None): + if not data: + return users = await UserConsole.filter(user_id__in=data.keys()).all() for user in users: data[user.user_id] = user @@ -347,7 +355,9 @@ async def _(cache_data: CacheData, module: str): @CacheRoot.with_refresh(CacheType.LIMIT) -async def _(data: dict[str, list[PluginLimit]]): +async def _(data: dict[str, list[PluginLimit]] | None): + if not data: + return limits = await PluginLimit.filter(module__in=data.keys(), load_status=True).all() data.clear() for limit in limits: