🐛 修复webui好友数量显示和登录次数

This commit is contained in:
HibiKier 2024-10-14 22:17:05 +08:00
parent e98af0ac21
commit 6358ce5266
3 changed files with 7 additions and 3 deletions

View File

@ -49,7 +49,7 @@ class BotManage:
)
group_list, _ = await PlatformUtils.get_group_list(bot)
group_list = [g for g in group_list if g.channel_id is None]
friend_list = await PlatformUtils.get_friend_list(bot)
friend_list, _ = await PlatformUtils.get_friend_list(bot)
bot_info.group_count = len(group_list)
bot_info.friend_count = len(friend_list)
bot_info.day_call = await Statistics.filter(

View File

@ -16,6 +16,7 @@ from zhenxun.utils.platform import PlatformUtils
from zhenxun.models.plugin_info import PluginInfo
from zhenxun.models.chat_history import ChatHistory
from zhenxun.models.group_console import GroupConsole
from zhenxun.models.bot_connect_log import BotConnectLog
from ....base_model import Result
from .data_source import bot_live
@ -94,6 +95,9 @@ async def _(bot_id: str | None = None) -> Result:
create_time__gte=now - timedelta(hours=now.hour)
).count()
select_bot.day_call = day_call
select_bot.connect_count = await BotConnectLog.filter(
bot_id=select_bot.self_id
).count()
return Result.ok(bot_list, "拿到信息啦!")
return Result.warning_("无Bot连接...")

View File

@ -36,6 +36,8 @@ class BaseInfo(BaseModel):
"""连接时间"""
connect_date: str | None = None
"""连接日期"""
connect_count: int = 0
"""连接次数"""
plugin_count: int = 0
"""加载插件数量"""
@ -47,8 +49,6 @@ class BaseInfo(BaseModel):
is_select: bool = False
"""当前选择"""
config: Config | None = None
"""nb配置"""
day_call: int = 0
"""今日调用插件次数"""
version: str = "unknown"