refactor: 项目重命名为37du自动化工作台,完成全链路更新

本次提交完成了项目从"业务场景工具集"到"自动化工作台"的全链路重命名:
1.  更新所有页面标题、应用名称配置
2.  重构前端登录页UI与交互逻辑,新增启动加载动画
3.  移除旧版钉钉登录相关API与代码
4.  优化控制面板后台统计接口的SQL查询与字段映射
5.  新增agent_cli命令行管理工具,支持插件与账号权限管理
6.  修复后端插件权限校验逻辑,新增云端权限拉取能力
7.  更新控制面登录页面样式与交互体验
This commit is contained in:
2026-09-14 00:34:54 +08:00
parent 6f248b0741
commit 67bb73fa30
10 changed files with 996 additions and 489 deletions
+21 -22
View File
@@ -1413,23 +1413,21 @@ def admin_stats(x_admin_token: str = Header(default="", alias="X-Admin-Token"),
_require_admin(x_admin_token, x_api_token)
with _db() as conn:
users = dict(conn.execute(
"SELECT (SELECT COUNT(*) FROM accounts), "
"(SELECT COUNT(*) FROM accounts WHERE is_admin = 1), "
"(SELECT COUNT(DISTINCT account) FROM account_plugins)").fetchone())
"SELECT (SELECT COUNT(*) FROM accounts) AS total, "
"(SELECT COUNT(*) FROM accounts WHERE is_admin = 1) AS admins, "
"(SELECT COUNT(DISTINCT account) FROM account_plugins) AS authorized").fetchone())
plugins = dict(conn.execute(
"SELECT "
" (SELECT COUNT(*) FROM plugins), "
" (SELECT COUNT(*) FROM plugins WHERE status = 'published'), "
" (SELECT COUNT(*) FROM plugins WHERE status = 'disabled'), "
" (SELECT COUNT(*) FROM plugins WHERE status = 'revoked')").fetchone())
"SELECT (SELECT COUNT(*) FROM plugins) AS total, "
"(SELECT COUNT(*) FROM plugins WHERE status = 'published') AS published, "
"(SELECT COUNT(*) FROM plugins WHERE status = 'disabled') AS disabled, "
"(SELECT COUNT(*) FROM plugins WHERE status = 'revoked') AS revoked").fetchone())
runs = dict(conn.execute(
"SELECT "
" (SELECT COUNT(*) FROM runtime_reports WHERE status = 'start'), "
" (SELECT COUNT(*) FROM runtime_reports WHERE status IN ('done','success')), "
" (SELECT COUNT(*) FROM runtime_reports WHERE status IN ('error','failed')), "
" (SELECT COALESCE(SUM(duration_sec),0) FROM runtime_reports), "
" (SELECT COUNT(DISTINCT account) FROM runtime_reports WHERE account <> ''), "
" (SELECT COUNT(DISTINCT plugin_id) FROM runtime_reports WHERE plugin_id <> '')").fetchone())
"SELECT (SELECT COUNT(*) FROM runtime_reports WHERE status = 'start') AS started, "
"(SELECT COUNT(*) FROM runtime_reports WHERE status IN ('done','success')) AS success, "
"(SELECT COUNT(*) FROM runtime_reports WHERE status IN ('error','failed')) AS failed, "
"(SELECT COALESCE(SUM(duration_sec),0) FROM runtime_reports) AS duration_sec, "
"(SELECT COUNT(DISTINCT account) FROM runtime_reports WHERE account <> '') AS active_users, "
"(SELECT COUNT(DISTINCT plugin_id) FROM runtime_reports WHERE plugin_id <> '') AS active_plugins").fetchone())
# 近 14 天运行趋势(按日:触发次数 / 成功 / 失败)
trend_rows = conn.execute(
@@ -1486,14 +1484,15 @@ def admin_stats(x_admin_token: str = Header(default="", alias="X-Admin-Token"),
for rc in recent:
rc["nickname"] = nick.get(rc.get("account", ""), "")
now_day = datetime.now().strftime("%Y-%m-%d")
return {
"users": {"total": int(users[0] or 0), "admins": int(users[1] or 0),
"authorized": int(users[2] or 0)},
"plugins": {"total": int(plugins[0] or 0), "published": int(plugins[1] or 0),
"disabled": int(plugins[2] or 0), "revoked": int(plugins[3] or 0)},
"runs": {"total": int(runs[0] or 0), "success": int(runs[1] or 0),
"failed": int(runs[2] or 0), "durationSec": int(runs[3] or 0),
"activeUsers": int(runs[4] or 0), "activePlugins": int(runs[5] or 0)},
"users": {"total": int(users["total"] or 0), "admins": int(users["admins"] or 0),
"authorized": int(users["authorized"] or 0)},
"plugins": {"total": int(plugins["total"] or 0), "published": int(plugins["published"] or 0),
"disabled": int(plugins["disabled"] or 0), "revoked": int(plugins["revoked"] or 0)},
"runs": {"total": int(runs["started"] or 0), "success": int(runs["success"] or 0),
"failed": int(runs["failed"] or 0), "durationSec": int(runs["duration_sec"] or 0),
"activeUsers": int(runs["active_users"] or 0), "activePlugins": int(runs["active_plugins"] or 0)},
"trend": trend, "topPlugins": top_plugins, "topUsers": top_users,
"recent": recent, "today": now_day,
}