From 8838fc51f8843e711ac28f105bf2cbb91abad5ad Mon Sep 17 00:00:00 2001 From: shanshanzhong Date: Tue, 31 Mar 2026 05:56:09 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8D=95=E8=AE=A2=E9=98=85=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E5=AE=B6=E5=BA=AD=E7=BB=84=E8=B4=AD=E4=B9=B0=E6=97=B6?= =?UTF-8?q?=E7=94=A8=20SubscriptionUserId=20=E6=9F=A5=E9=94=9A=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NewPurchase 中查 FindSingleModeAnchorSubscribe 时,家庭组 场景下应使用实际受益者 SubscriptionUserId(成员/主), 而非付款人 UserId,否则找不到已有订阅,会为成员创建新订阅。 Co-Authored-By: claude-flow --- queue/logic/order/activateOrderLogic.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/queue/logic/order/activateOrderLogic.go b/queue/logic/order/activateOrderLogic.go index ebbbafb..f8d84a5 100644 --- a/queue/logic/order/activateOrderLogic.go +++ b/queue/logic/order/activateOrderLogic.go @@ -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 {