最低价格约束
This commit is contained in:
@@ -196,6 +196,14 @@ func (s *resourceService) CalcPrice(skuCode string, count int32, user *m.User, c
|
||||
couponApplied = discounted.Sub(coupon.Amount)
|
||||
}
|
||||
|
||||
// 约束到最低价格
|
||||
if discounted.Cmp(sku.PriceMin) < 0 {
|
||||
discounted = sku.PriceMin.Copy()
|
||||
}
|
||||
if couponApplied.Cmp(sku.PriceMin) < 0 {
|
||||
couponApplied = sku.PriceMin.Copy()
|
||||
}
|
||||
|
||||
return sku, discount, coupon, discounted, couponApplied, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user