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 813bee743b
commit 6d2dd93628
54 changed files with 5542 additions and 1890 deletions
+5 -5
View File
@@ -42,7 +42,7 @@ def admin_me(x_admin_token: str = Header(default="", alias="X-Admin-Token"),
return {"account": "", "is_admin": False, "dept": "", "nickname": "", "avatar": ""}
with _db() as conn:
row = conn.execute(
"SELECT is_admin, dept, nickname, status, avatar FROM accounts WHERE account = ?",
"SELECT is_admin, dept, nickname, status, avatar FROM accounts WHERE account = %s",
(account,)).fetchone()
# 账号停用:视为未登录(执行机/控制面前端据此自动登出)
if not row or not row["status"]:
@@ -74,7 +74,7 @@ def admin_auth(a: schemas.AuthIn,
with _db() as conn:
row = conn.execute(
"SELECT password_hash, salt, is_admin, dept, nickname, must_change_pwd, status, avatar "
"FROM accounts WHERE account = ?",
"FROM accounts WHERE account = %s",
(account,)).fetchone()
if not row or not _verify_password(a.password, row["salt"], row["password_hash"]):
_auth_fail(account)
@@ -105,7 +105,7 @@ def admin_password(p: schemas.PwdIn,
raise HTTPException(403, "只能修改自己的密码")
with _db() as conn:
row = conn.execute(
"SELECT password_hash, salt, must_change_pwd FROM accounts WHERE account = ?",
"SELECT password_hash, salt, must_change_pwd FROM accounts WHERE account = %s",
(login,)).fetchone()
if not row:
raise HTTPException(401, "账号不存在")
@@ -115,8 +115,8 @@ def admin_password(p: schemas.PwdIn,
raise HTTPException(401, "原密码错误")
_hex, _salt = _hash_password(p.new_password)
with _db() as conn:
conn.execute("UPDATE accounts SET password_hash = ?, salt = ?, must_change_pwd = 0 "
"WHERE account = ?", (_hex, _salt, login))
conn.execute("UPDATE accounts SET password_hash = %s, salt = %s, must_change_pwd = 0 "
"WHERE account = %s", (_hex, _salt, login))
conn.commit()
return {"ok": True, "account": login}