chore: 管理端与 API 批量更新(测评恢复、看板、分销与用户)

1、修复了用户详情/测评结果与人脸结果解析展示问题;管理端订单、分销及超管用户相关接口与展示异常。

2、新增了 testResultParse 统一解析工具、mbti_test_results 恢复 SQL 及生成脚本;补充 API 路由与 Dashboard/用户侧能力。

3、优化了企业/超管数据看板与分销结算逻辑;精简超管 Settings 与布局代码;完善 faceResultDetail;小程序 app.js 小幅同步。

Made-with: Cursor
This commit is contained in:
Ghost
2026-03-31 10:56:28 +08:00
parent 3af7bb35dd
commit 3fdf9b6ed2
18 changed files with 1306 additions and 546 deletions

View File

@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
"""Generate restore_mbti_test_results_1_145.sql from api/mbti_data.sql."""
import pathlib
ROOT = pathlib.Path(__file__).resolve().parents[2]
src = ROOT / "mbti_data.sql"
out = pathlib.Path(__file__).resolve().parent / "restore_mbti_test_results_1_145.sql"
lines = src.read_text(encoding="utf-8").splitlines()
starts = None
ends = None
for i, L in enumerate(lines):
if starts is None and L.startswith("INSERT INTO `mbti_test_results`") and "VALUES (1," in L:
starts = i
if L.startswith("INSERT INTO `mbti_test_results`") and "VALUES (145," in L:
ends = i + 1
break
if starts is None or ends is None:
raise SystemExit(f"range not found: starts={starts} ends={ends}")
chunk = lines[starts:ends]
head = """-- 恢复 mbti_test_results 表 id 1145与 api/mbti_data.sql 中导出一致)
-- 用法mysql -u... -p... 数据库名 < restore_mbti_test_results_1_145.sql
-- REPLACE 会按主键删除旧行再插入,执行前请备份。
SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;
SET FOREIGN_KEY_CHECKS = 0;
START TRANSACTION;
"""
body = "\n".join(L.replace("INSERT INTO", "REPLACE INTO", 1) for L in chunk)
tail = """
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
"""
out.write_text(head + body + tail, encoding="utf-8")
print("wrote", out, "statements", len(chunk))

File diff suppressed because one or more lines are too long