fix: 单订阅模式家庭组购买时用 SubscriptionUserId 查锚点
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 7m28s
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 7m28s
NewPurchase 中查 FindSingleModeAnchorSubscribe 时,家庭组 场景下应使用实际受益者 SubscriptionUserId(成员/主), 而非付款人 UserId,否则找不到已有订阅,会为成员创建新订阅。 Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
parent
ea34718a0b
commit
8838fc51f8
@ -229,9 +229,14 @@ func (l *ActivateOrderLogic) NewPurchase(ctx context.Context, orderInfo *order.O
|
||||
|
||||
var userSub *user.Subscribe
|
||||
|
||||
// 单订阅模式下,优先兜底为“续费语义”:延长已购订阅,避免并发下重复创建 user_subscribe
|
||||
// 单订阅模式下,优先兜底为”续费语义”:延长已购订阅,避免并发下重复创建 user_subscribe
|
||||
if l.svc.Config.Subscribe.SingleModel {
|
||||
anchorSub, anchorErr := l.svc.UserModel.FindSingleModeAnchorSubscribe(ctx, orderInfo.UserId)
|
||||
// 家庭组场景:订阅实际属于 SubscriptionUserId(成员/主),而非付款人 UserId
|
||||
singleModeUserId := orderInfo.UserId
|
||||
if orderInfo.SubscriptionUserId > 0 {
|
||||
singleModeUserId = orderInfo.SubscriptionUserId
|
||||
}
|
||||
anchorSub, anchorErr := l.svc.UserModel.FindSingleModeAnchorSubscribe(ctx, singleModeUserId)
|
||||
switch {
|
||||
case anchorErr == nil && anchorSub != nil:
|
||||
if orderInfo.ParentId == 0 && anchorSub.OrderId > 0 && anchorSub.OrderId != orderInfo.Id {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user