+ StoreMap.PricePercentagePack

This commit is contained in:
gazebo
2019-07-15 15:37:45 +08:00
parent 598a9738e8
commit ae4dff1b2d
5 changed files with 96 additions and 14 deletions

View File

@@ -243,6 +243,40 @@ func CaculateSkuPriceFromVendor(vendorPrice, percentage, catPercentage int) int
return price
}
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
// }
// }
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
// }
// }
return pricePercentage
}
func IsSkuSpecial(specQuality float32, specUnit string) bool {
return int(specQuality) == model.SpecialSpecQuality && (specUnit == model.SpecialSpecUnit || specUnit == model.SpecialSpecUnit2)
}