chore: 管理端与 API 批量更新(测评恢复、看板、分销与用户)
1、修复了用户详情/测评结果与人脸结果解析展示问题;管理端订单、分销及超管用户相关接口与展示异常。 2、新增了 testResultParse 统一解析工具、mbti_test_results 恢复 SQL 及生成脚本;补充 API 路由与 Dashboard/用户侧能力。 3、优化了企业/超管数据看板与分销结算逻辑;精简超管 Settings 与布局代码;完善 faceResultDetail;小程序 app.js 小幅同步。 Made-with: Cursor
This commit is contained in:
38
api/database/migrations/_gen_restore_mbti_test_results.py
Normal file
38
api/database/migrations/_gen_restore_mbti_test_results.py
Normal 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 1~145(与 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))
|
||||
155
api/database/migrations/restore_mbti_test_results_1_145.sql
Normal file
155
api/database/migrations/restore_mbti_test_results_1_145.sql
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user