fix(会员结算): 拒绝过期新购单覆盖更新的会员
- 冻结的新购单下单时用户无有效会员,若支付前已通过其他订单获得有效会员,结算会按 user_id 删除重插,覆盖更新 / 更长的会员。 - 在 apply_profile_membership_purchase 中当 change_kind 为 Purchase 且 active_row 存在时返回「会员状态已变化,请重新下单」,与升级分支守卫一致。 - 历史无快照的重算路径只会在 active_row 为空时产出 Purchase,不受影响。
This commit is contained in:
@@ -9968,6 +9968,15 @@ fn apply_profile_membership_purchase(
|
||||
)?,
|
||||
};
|
||||
|
||||
// 中文注释:冻结的新购单在下单时用户无有效会员;若支付前用户已通过其他订单获得有效会员,
|
||||
// 继续走新购会按 user_id 删除重插,覆盖掉更新 / 更长的会员(降档或丢失已付时长),
|
||||
// 因此拒绝并要求重新下单。历史重算路径只会在 active_row 为空时产出 Purchase,不受影响。
|
||||
if settlement.change_kind == RuntimeProfileMembershipChangeKind::Purchase
|
||||
&& active_row.is_some()
|
||||
{
|
||||
return Err("会员状态已变化,请重新下单".to_string());
|
||||
}
|
||||
|
||||
if settlement.change_kind == RuntimeProfileMembershipChangeKind::Upgrade {
|
||||
if let Some(row) = active_row {
|
||||
// 中文注释:结算前比对订单冻结的变更前状态。若用户已先付了更高档位的升级单、
|
||||
|
||||
Reference in New Issue
Block a user