- 修复CaculateSkuPrice四舍五入的bug
This commit is contained in:
@@ -211,16 +211,16 @@ func CaculateSkuPrice(unitPrice int, specQuality float32, specUnit string, skuNa
|
||||
return unitPrice
|
||||
}
|
||||
specQuality2 := RegularizeSkuQuality(specQuality, specUnit)
|
||||
price := int(math.Round(float64(unitPrice * specQuality2 / model.SpecialSpecQuality)))
|
||||
floatPrice := float64(unitPrice) * float64(specQuality2) / float64(model.SpecialSpecQuality)
|
||||
// if specQuality2 < 250 {
|
||||
// price = price * 110 / 100
|
||||
// floatPrice = floatPrice * 110 / 100
|
||||
// } else if specQuality2 < 500 {
|
||||
// price = price * 105 / 100
|
||||
// floatPrice = floatPrice * 105 / 100
|
||||
// }
|
||||
if price <= 0 {
|
||||
price = 1
|
||||
if floatPrice <= 1 {
|
||||
floatPrice = 1
|
||||
}
|
||||
return price
|
||||
return int(math.Round(floatPrice))
|
||||
}
|
||||
|
||||
// 计算SKU标准价格,CaculateSkuPrice的逆过程
|
||||
@@ -268,7 +268,7 @@ func CaculateSkuPriceFromVendor(vendorPrice, percentage, catPercentage int) int
|
||||
catPercentage = 100
|
||||
}
|
||||
percentage = percentage * catPercentage / 100
|
||||
price := int(math.Round(float64(vendorPrice * 100 / percentage)))
|
||||
price := int(math.Round(float64(vendorPrice) * 100 / float64(percentage)))
|
||||
if price < 0 {
|
||||
price = 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user