fix(会员): 存量库首次读取补种会员档位目录

- profile.rs 在 membership_plan_row / membership_plan_records 恢复懒播种,避免增量发布不触发 init reducer 导致 profile_membership_plan 为空。

- 下单校验、升级报价、充值中心读取目录前都会先补种代码内种子目录。
This commit is contained in:
2026-10-03 19:05:26 +08:00
parent ba451bfc0c
commit 888a94ac86
@@ -9226,6 +9226,8 @@ fn membership_plan_row(
ctx: &ReducerContext,
plan: RuntimeProfileMembershipPlan,
) -> Option<ProfileMembershipPlan> {
// 存量库增量发布不会触发 init reducer;首次读取时懒播种,避免目录为空导致下单 / 报价失败。
ensure_default_profile_membership_plan(ctx);
ctx.db.profile_membership_plan().plan().find(&plan)
}
@@ -9265,8 +9267,10 @@ fn membership_plan_snapshot(
})
}
/// 充值中心与后台共用的目录行读取,按 `rank` 升序;只读,不再触发表为空时的懒播种。
/// 充值中心与后台共用的目录行读取,按 `rank` 升序;表为空时先补种代码内目录。
fn membership_plan_records(ctx: &ReducerContext) -> Vec<RuntimeProfileMembershipPlanRecord> {
// 存量库增量发布不会触发 init reducer;首次读取时懒播种,避免充值中心目录为空。
ensure_default_profile_membership_plan(ctx);
let mut rows = ctx.db.profile_membership_plan().iter().collect::<Vec<_>>();
rows.sort_by(|left, right| {
left.rank