refactor: 整体迁移控制面至MySQL + 替换UI框架为Element Plus

1. 移除naive-ui依赖,迁移前端至Element Plus
2. 重构后端数据库层,切换为MySQL替代SQLite
3. 调整项目部署架构,停止exe打包改为源码部署
4. 新增设备上报接口与相关数据库模型
5. 优化配置路径与SQL语法,替换为MySQL占位符格式
6. 调整站点名称与文案,统一为「37du 插件管理平台」
7. 新增SQLite到MySQL迁移脚本
This commit is contained in:
2026-09-16 15:58:45 +08:00
parent 4363116e31
commit 84d3e103ec
54 changed files with 5542 additions and 1890 deletions
+4 -10
View File
@@ -8,7 +8,8 @@
- dingtalk.py 钉钉官方接口 - pkgutil.py 插件包校验/解析/版本
- schemas.py 请求体模型 - apis/ 路由子包(meta/plugins/auth/dingtalk/admin)
DB:controlplane.db(同目录)。包文件:packages/。可选:CONTROLPLANE_TOKEN 非空时客户端须带
DB:MySQL(连接参数在 controlplane/.env 的 MYSQL_*,库 37du_center;首次启动自动建库建表+种子)。
包文件:packages/。可选:CONTROLPLANE_TOKEN 非空时客户端须带
X-API-Token 请求头。
运行(本地 .venv,需在 desktop/ 目录下执行,模块搜索根 = desktop/):
@@ -23,7 +24,6 @@ from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.staticfiles import StaticFiles
from controlplane import config
from controlplane.core.db import _init_db, _seed
@@ -41,7 +41,7 @@ async def lifespan(app: FastAPI):
yield
app = FastAPI(title="37du 内网插件控制面", lifespan=lifespan)
app = FastAPI(title="37du 插件管理平台", lifespan=lifespan)
app.add_middleware(CORSMiddleware, allow_origins=["*"],
allow_methods=["*"], allow_headers=["*"])
@@ -52,12 +52,6 @@ app.include_router(api_dingtalk.router)
app.include_router(api_admin.router)
# ==================== 挂载控制面前端产物 ====================
# 源码模式 => config.DIST(controlplane/frontend/dist);exe 模式 => _MEIPASS/frontend/dist(打进 exe)
if config.DIST.is_dir():
app.mount("/", StaticFiles(directory=str(config.DIST), html=True), name="web")
if __name__ == "__main__":
import uvicorn
@@ -86,6 +80,6 @@ if __name__ == "__main__":
if sys.stderr is None:
sys.stderr = open(os.devnull, "w")
print(f"[controlplane] http://0.0.0.0:{config.CONTROLPLANE_PORT} sqlite={config.DB_PATH.name}")
print(f"[controlplane] http://0.0.0.0:{config.CONTROLPLANE_PORT} mysql={config.MYSQL_DB}@{config.MYSQL_HOST}")
uvicorn.run(app, host="0.0.0.0", port=config.CONTROLPLANE_PORT,
log_config=LOG_CONFIG, log_level="info")