feat: 增加后端初始化逻辑,自动向数据库注入审计日志菜单与默认权限

This commit is contained in:
DXC
2026-03-10 12:24:34 +08:00
parent be6575344a
commit e1e74e5983
2 changed files with 64 additions and 1 deletions

View File

@ -142,8 +142,17 @@ def create_app():
except ImportError as e:
print(f"❌ 错误: Audit 模块导入失败: {e}")
# 2.9 初始化审计日志菜单和权限(防重复)
# -----------------------------------------------------
# 2.9 注册库位管理模块 (Warehouse)
try:
from app.services.permission_service import PermissionService
with app.app_context():
PermissionService.init_audit_menu()
except Exception as e:
print(f"⚠️ 审计日志菜单初始化跳过: {e}")
# -----------------------------------------------------
# 2.10 注册库位管理模块 (Warehouse)
# -----------------------------------------------------
try:
from app.api.v1.warehouse import warehouse_bp