| 12345678910111213141516171819202122232425 |
- -- ============================================================
- -- 同步数据修复脚本(2026-04-25)
- -- 背景:原同步服务使用 indicator_init.sql 的旧指标ID(1001+),
- -- 与 score.sql 的新指标ID(11, 12, ...)不匹配,
- -- 导致所有已同步 score_event 记录的 indicator_id 无效。
- -- 同时,reward_penalty / leave_special / banner_letter
- -- 按最新配分表属于"暂无台账,不考虑导入规则",已从同步逻辑移除。
- -- ============================================================
- -- 步骤1:清空所有台账同步写入的 score_event(source_type='2')
- -- 手动录入(source_type='1')不受影响
- DELETE FROM score_event WHERE source_type = '2';
- -- 步骤2:确认当前 score_indicator 使用的是 score.sql 中的新ID(11, 12...)
- -- 如果 MAX(id) 约 1500,说明是新版;如果约 1343,说明还是旧版,需重建指标
- -- SELECT MAX(id), COUNT(*) FROM score_indicator WHERE del_flag='0';
- -- 步骤3(如果指标仍是旧版 1001+ ID,需要重建):
- -- DELETE FROM score_indicator;
- -- 然后重新执行 score.sql 中三段 INSERT INTO score_indicator(ID 11~1522)
- -- 步骤4:部署新版后端代码后,在页面点击"同步台账"重新同步
- -- 或调用接口:POST /ledger/sync/all
- -- ============================================================
|