fix
This commit is contained in:
parent
87d3985a60
commit
eaf5f86a19
|
@ -136,9 +136,9 @@ func (d *defaultShoppingCart) CaculateStepPrice(purchaseQuantity int64, stepPric
|
||||||
//遍历查询合适的价格
|
//遍历查询合适的价格
|
||||||
for k, v := range stepPrice.PriceRange {
|
for k, v := range stepPrice.PriceRange {
|
||||||
//购买数量>起点
|
//购买数量>起点
|
||||||
if purchaseQuantity > v.StartQuantity {
|
if purchaseQuantity >= v.StartQuantity {
|
||||||
//最后一个 || 小于等于终点
|
//最后一个 || 小于终点
|
||||||
if k == l-1 || (purchaseQuantity < v.EndQuantity && purchaseQuantity >= v.StartQuantity) {
|
if k == l-1 || purchaseQuantity < v.EndQuantity {
|
||||||
itemPrice = v.Price + fittingPrice
|
itemPrice = v.Price + fittingPrice
|
||||||
return itemPrice * purchaseQuantity, itemPrice, nil
|
return itemPrice * purchaseQuantity, itemPrice, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user