修复错误报错
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m0s

This commit is contained in:
2026-04-24 17:53:22 +08:00
parent 85bef83752
commit 7efcea2b54
2 changed files with 8 additions and 1 deletions

View File

@@ -208,8 +208,9 @@ func (s *Service) CreateAdminOrder(ctx context.Context, req *dto.CreateAdminOrde
}
// 先按零售价构建明细价格快照,后续在代购/成本价场景覆盖
// offline 场景先使用平台零售价,避免在平台代购场景下提前依赖代理分配记录
sellerShopIDValue := uint(0)
if resourceShopID != nil {
if req.PaymentMethod != model.PaymentMethodOffline && resourceShopID != nil {
sellerShopIDValue = *resourceShopID
}
itemUnitPriceMap, retailTotalAmount, err := s.buildRetailPriceMap(ctx, validationResult.Packages, sellerShopIDValue)

View File

@@ -183,6 +183,9 @@ func (s *Service) GetPurchasePrice(ctx context.Context, pkg *model.Package, sell
if sellerShopID > 0 {
allocation, err := s.packageAllocationStore.GetByShopAndPackageForSystem(ctx, sellerShopID, pkg.ID)
if err != nil {
if err == gorm.ErrRecordNotFound {
return 0, errors.New(errors.CodeInvalidParam, "套餐已下架")
}
return 0, errors.Wrap(errors.CodeInternalError, err, "查询套餐分配记录失败")
}
return allocation.RetailPrice, nil
@@ -198,6 +201,9 @@ func (s *Service) GetCostPrice(ctx context.Context, pkg *model.Package, sellerSh
}
allocation, err := s.packageAllocationStore.GetByShopAndPackageForSystem(ctx, sellerShopID, pkg.ID)
if err != nil {
if err == gorm.ErrRecordNotFound {
return 0, errors.New(errors.CodeInvalidParam, "店铺没有该套餐的分配配置")
}
return 0, errors.Wrap(errors.CodeInternalError, err, "查询套餐分配记录失败")
}
return allocation.CostPrice, nil