fix: 修复平台自营资源(未分配代理)无法线下下单的问题
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m56s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m56s
offline 支付分支新增平台自营子场景判断: - 资源 shopID 为空时(未分配给任何代理商),使用零售价直接创建订单 - 资源 shopID 不为空时(属于代理商),走原有平台代购逻辑 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -398,7 +398,25 @@ func (s *Service) CreateAdminOrder(ctx context.Context, req *dto.CreateAdminOrde
|
||||
|
||||
// 根据支付方式分别处理
|
||||
if req.PaymentMethod == model.PaymentMethodOffline {
|
||||
// ==== 场景 1:平台代购(offline)====
|
||||
// ==== 场景 1:offline(线下支付)====
|
||||
isPlatformOwned := resourceShopID == nil || *resourceShopID == 0
|
||||
|
||||
if isPlatformOwned {
|
||||
// ==== 子场景 1.1:平台自营(资源未分配给代理商)====
|
||||
// 平台直接销售给终端用户,无代理商参与,使用零售价,无需查询分配配置
|
||||
orderBuyerType = model.BuyerTypePersonal
|
||||
orderBuyerID = 0
|
||||
paymentMethod = model.PaymentMethodOffline
|
||||
paymentStatus = model.PaymentStatusPaid
|
||||
paidAt = &now
|
||||
isPurchaseOnBehalf = false
|
||||
sellerCostPrice = 0
|
||||
operatorID = nil
|
||||
operatorType = constants.OwnerTypePlatform
|
||||
purchaseRole = model.PurchaseRoleSelfPurchase
|
||||
actualPaidAmount = nil
|
||||
} else {
|
||||
// ==== 子场景 1.2:平台代购(资源属于代理商,平台代为购买)====
|
||||
purchaseBuyerID, buyerCostPrice, purchasePaidAt, err := s.resolvePurchaseOnBehalfInfo(ctx, validationResult)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -417,6 +435,7 @@ func (s *Service) CreateAdminOrder(ctx context.Context, req *dto.CreateAdminOrde
|
||||
operatorType = constants.OwnerTypePlatform
|
||||
purchaseRole = model.PurchaseRolePurchasedByPlatform
|
||||
actualPaidAmount = nil
|
||||
}
|
||||
|
||||
} else if req.PaymentMethod == model.PaymentMethodWallet {
|
||||
// ==== 场景 2:代理钱包支付(wallet)====
|
||||
|
||||
Reference in New Issue
Block a user