赠送套餐逻辑
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m55s

This commit is contained in:
2026-04-28 17:40:06 +08:00
parent 516a7f5bdf
commit 37b4483183
34 changed files with 1172 additions and 60 deletions

View File

@@ -11,6 +11,7 @@ import (
"github.com/break/junhong_cmp_fiber/internal/model"
"github.com/break/junhong_cmp_fiber/internal/model/dto"
asset "github.com/break/junhong_cmp_fiber/internal/service/asset"
"github.com/break/junhong_cmp_fiber/internal/service/packageprice"
"github.com/break/junhong_cmp_fiber/internal/store"
"github.com/break/junhong_cmp_fiber/internal/store/postgres"
"github.com/break/junhong_cmp_fiber/pkg/constants"
@@ -526,13 +527,16 @@ func buildClientPackageItem(
if pkg == nil || pkg.Status != constants.StatusEnabled {
return dto.ClientPackageItem{}, false
}
if pkg.IsGift {
return dto.ClientPackageItem{}, false
}
isAddon := pkg.PackageType == constants.PackageTypeAddon
if isAddon && !resolved.MainPackageActived {
return dto.ClientPackageItem{}, false
}
retailPrice := pkg.SuggestedRetailPrice
retailPrice := packageprice.PackageEffectiveRetailPrice(pkg)
costPrice := pkg.CostPrice
if resolved.IsAgentChannel {
@@ -543,7 +547,7 @@ func buildClientPackageItem(
if allocation.ShelfStatus != constants.ShelfStatusOn || allocation.Status != constants.StatusEnabled {
return dto.ClientPackageItem{}, false
}
retailPrice = allocation.RetailPrice
retailPrice = packageprice.AllocationEffectiveRetailPrice(allocation)
costPrice = allocation.CostPrice
} else if pkg.ShelfStatus != constants.ShelfStatusOn {
return dto.ClientPackageItem{}, false