|
|
@@ -455,7 +455,12 @@ INSERT INTO t_courses_activity_user_discount_log
|
|
|
(activity_user_discount_id, courses_student_id, discount_amount_used, create_time, memo)
|
|
|
VALUES (?, ?, ?, NOW(3), ?)`,
|
|
|
poolID, c.StuCourseNumericID, yuan(dl.MoneyCents), dl.Memo).Error; err != nil {
|
|
|
- return fmt.Errorf("种子 target 额度流水失败:%w", err)
|
|
|
+ // 这条报错文案要把"预期内"和"真错"分开 —— 断言只能拦住,拦不住人的判断。
|
|
|
+ return fmt.Errorf("种子写入 t_courses_activity_user_discount_log.courses_student_id=%d 失败:%w\n"+
|
|
|
+ " 该列**故意不种** `t_courses_student`(本 case 不校验报课行存在性;"+
|
|
|
+ "比对里 `#<numeric>` 兜底归一依赖「该表无 FK」)。\n"+
|
|
|
+ " ⇒ 若你**刚给这张表加了外键**,这是预期行为,需要同时给 case 补 `t_courses_student` 种子;"+
|
|
|
+ "否则请检查是不是种子本身写错了。", c.StuCourseNumericID, err)
|
|
|
}
|
|
|
}
|
|
|
// 用量流水:`order_no` 与 legacy 的 `orderid` 同一个字符串(两侧游标靠它定位)。
|