mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-06 17:50:20 +00:00
- 移除原监控仪表盘独立模块,将相关功能合并到在线监控模块 - 重构租户配置字段名,统一使用logo_url和name替代tenant_logo/tenant_name - 优化搜索工具函数,移除重复导入 - 调整参数配置模型字段长度限制,移除config_value的max_length约束 - 清理冗余的常量定义和导入语句 - 修复批量状态设置接口的redis依赖注入 - 增强OAuth登录安全性,添加租户默认归属和state一次性消费 - 优化资源目录缓存逻辑,减少重复计算 - 新增API Token模块基础框架 - 完善用户token版本管理,支持主动失效JWT - 调整AI模型配置缓存过期时间 - 修复菜单类型字段索引,提升查询性能 - 简化前端刷新token调用逻辑 - 新增滑块验证完成接口和忘记密码验证码校验 - 调整系统配置默认值,添加操作日志保留天数和接口白名单配置 - 限制Mock支付回调仅在开发环境可用 - 重构websocket认证方式,支持更安全的subprotocol传参
52 lines
1.6 KiB
Python
52 lines
1.6 KiB
Python
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, Field, model_validator
|
|
|
|
from app.common.enums import QueueEnum
|
|
from app.core.base_schema import SessionInfoSchema
|
|
|
|
|
|
class OnlineOutSchema(SessionInfoSchema):
|
|
"""在线用户响应模型 — ``SessionInfoSchema`` 的公开子集。"""
|
|
|
|
|
|
class OnlineQueryParam(BaseModel):
|
|
"""在线用户查询参数"""
|
|
|
|
name: str | tuple[str, str] | None = Field(None, description="登录名称")
|
|
ipaddr: str | tuple[str, str] | None = Field(None, description="登陆IP地址")
|
|
login_location: str | tuple[str, str] | None = Field(None, description="登录所属地")
|
|
|
|
@model_validator(mode="after")
|
|
def validate_query_params(self) -> "OnlineQueryParam":
|
|
if isinstance(self.name, str):
|
|
self.name = (QueueEnum.like.value, self.name)
|
|
if isinstance(self.ipaddr, str):
|
|
self.ipaddr = (QueueEnum.like.value, self.ipaddr)
|
|
if isinstance(self.login_location, str):
|
|
self.login_location = (QueueEnum.like.value, self.login_location)
|
|
return self
|
|
|
|
|
|
class RecentLoginItem(BaseModel):
|
|
"""最近登录记录"""
|
|
username: str
|
|
status: int
|
|
login_time: datetime
|
|
login_ip: str | None = None
|
|
login_location: str | None = None
|
|
|
|
|
|
class DashboardStatsSchema(BaseModel):
|
|
"""仪表盘统计数据"""
|
|
online_users: int = 0
|
|
total_users: int = 0
|
|
total_tenants: int = 0
|
|
total_orders: int = 0
|
|
today_login_count: int = 0
|
|
today_unique_users: int = 0
|
|
week_user_created: int = 0
|
|
week_tenant_created: int = 0
|
|
paid_orders: int = 0
|
|
recent_logins: list[RecentLoginItem] = []
|