diff --git a/business/jxutils/jxutils_cms.go b/business/jxutils/jxutils_cms.go index 64501dc05..c67aa3402 100644 --- a/business/jxutils/jxutils_cms.go +++ b/business/jxutils/jxutils_cms.go @@ -245,35 +245,35 @@ func CaculateSkuPriceFromVendor(vendorPrice, percentage, catPercentage int) int func GetPricePercentage(l model.PricePercentagePack, price int, defPricePercentage int) (pricePercentage int) { pricePercentage = defPricePercentage - // if len(l) > 0 { - // var lastItem *model.PricePercentageItem - // for _, v := range l { - // lastItem = v - // if v.BeginPrice > price { - // break - // } - // } - // if lastItem != nil { - // pricePercentage = lastItem.PricePercentage - // } - // } + if len(l) > 0 { + var lastItem *model.PricePercentageItem + for _, v := range l { + lastItem = v + if v.BeginPrice > price { + break + } + } + if lastItem != nil { + pricePercentage = lastItem.PricePercentage + } + } return pricePercentage } func GetPricePercentageByVendorPrice(l model.PricePercentagePack, vendorPrice int, defPricePercentage int) (pricePercentage int) { pricePercentage = defPricePercentage - // if len(l) > 0 { - // var lastItem *model.PricePercentageItem - // for _, v := range l { - // lastItem = v - // if CaculateSkuVendorPrice(v.BeginPrice, v.PricePercentage, 0) > vendorPrice { - // break - // } - // } - // if lastItem != nil { - // pricePercentage = lastItem.PricePercentage - // } - // } + if len(l) > 0 { + var lastItem *model.PricePercentageItem + for _, v := range l { + lastItem = v + if CaculateSkuVendorPrice(v.BeginPrice, v.PricePercentage, 0) > vendorPrice { + break + } + } + if lastItem != nil { + pricePercentage = lastItem.PricePercentage + } + } return pricePercentage }