refactor: 整合仪表盘功能到监控模块,清理冗余代码

- 移除原监控仪表盘独立模块,将相关功能合并到在线监控模块
- 重构租户配置字段名,统一使用logo_url和name替代tenant_logo/tenant_name
- 优化搜索工具函数,移除重复导入
- 调整参数配置模型字段长度限制,移除config_value的max_length约束
- 清理冗余的常量定义和导入语句
- 修复批量状态设置接口的redis依赖注入
- 增强OAuth登录安全性,添加租户默认归属和state一次性消费
- 优化资源目录缓存逻辑,减少重复计算
- 新增API Token模块基础框架
- 完善用户token版本管理,支持主动失效JWT
- 调整AI模型配置缓存过期时间
- 修复菜单类型字段索引,提升查询性能
- 简化前端刷新token调用逻辑
- 新增滑块验证完成接口和忘记密码验证码校验
- 调整系统配置默认值,添加操作日志保留天数和接口白名单配置
- 限制Mock支付回调仅在开发环境可用
- 重构websocket认证方式,支持更安全的subprotocol传参
This commit is contained in:
zhangtao
2026-07-13 01:14:20 +08:00
parent 6a5f8cf0dd
commit cf88ab8897
102 changed files with 4078 additions and 3777 deletions
@@ -20,6 +20,8 @@ from sqlglot.expressions import (
Update,
)
from app.api.v1.module_platform.menu.crud import MenuCRUD
from app.api.v1.module_platform.menu.schema import MenuCreateSchema
from app.common.constant import GenConstant
from app.common.enums import QueueEnum
from app.config.path_conf import BASE_DIR
@@ -27,8 +29,9 @@ from app.config.setting import settings
from app.core.base_schema import AuthSchema, PageResultSchema
from app.core.exceptions import CustomException
from app.core.logger import logger
from app.utils.gen_util import GenUtils
from app.utils.jinja2_template_util import Jinja2TemplateUtil
from app.utils.common_util import CamelCaseUtil, compute_menu_route_first_segment, search_to_dict
from .gen_util import GenUtils
from .jinja2_template_util import Jinja2TemplateUtil
from .crud import GenTableColumnCRUD, GenTableCRUD
from .schema import (
@@ -84,8 +87,6 @@ class GenTableService:
pn = (package_name or "").strip()
# 1) 选择上级目录:从上级菜单 route_path 第一段推断 module_xxx
if parent_catalog_id is not None:
from app.api.v1.module_platform.menu.crud import MenuCRUD
m = await MenuCRUD(self.auth, self.db).get(id=parent_catalog_id)
if not m:
raise CustomException(msg="上级菜单不存在")
@@ -109,7 +110,6 @@ class GenTableService:
"""上级菜单仅允许目录:与前端树只展示目录一致,避免挂到菜单/按钮下。"""
if parent_menu_id is None:
return
from app.api.v1.module_platform.menu.crud import MenuCRUD
m = await MenuCRUD(self.auth, self.db).get(id=parent_menu_id)
if not m:
@@ -125,10 +125,7 @@ class GenTableService:
- **无上级目录**:``/module_xxx/...``(新分系统)
- **有上级目录**:``/module_xxx/...``(继承上级所属分系统)
"""
pn = (package_name or "").strip()
if not pn:
raise CustomException(msg="包名不能为空")
return pn if pn.startswith("module_") else f"module_{pn}"
return compute_menu_route_first_segment(parent_catalog_id, package_name, module_name)
def _catalog_menu_dir_key(self, parent_catalog_id: int | None, package_name: str, module_name: str | None) -> str:
"""菜单上「模块目录」节点的 name(与路由第一段 package 独立)。
@@ -154,9 +151,6 @@ class GenTableService:
business_name: str,
) -> int:
"""创建或复用 type=1 模块目录;固定为「目录 → 菜单 → 按钮」中的第一层目录。"""
from app.api.v1.module_platform.menu.schema import MenuCreateSchema
from app.utils.common_util import CamelCaseUtil
pn = (package_name or "").strip()
if not pn:
raise CustomException(msg="包名不能为空")
@@ -277,7 +271,7 @@ class GenTableService:
offset=offset,
limit=page_size,
order_by=order,
search=vars(search) if search else {},
search=search_to_dict(search, {}),
out_schema=GenTableOutSchema,
)
@@ -685,10 +679,6 @@ class GenTableService:
render_info = await self.__get_gen_render_info(table_name)
gen_table_schema: GenTableOutSchema = render_info[3]
from app.api.v1.module_platform.menu.crud import MenuCRUD
from app.api.v1.module_platform.menu.schema import MenuCreateSchema
from app.utils.common_util import CamelCaseUtil
# 按“上级目录”规则矫正最终包名(分系统根)
gen_table_schema.package_name = await self._effective_package_name(gen_table_schema.parent_menu_id, gen_table_schema.package_name)
# 统一权限前缀(对齐 module_example/demo):