fix(order) discount set default 1

This commit is contained in:
NoWay 2025-07-23 16:31:37 +08:00 committed by Leif Draven
parent 1b78e04113
commit a155a4f8cd

View File

@ -89,6 +89,9 @@ func (l *PurchaseLogic) Purchase(req *types.PurchaseOrderRequest) (resp *types.P
_ = json.Unmarshal([]byte(sub.Discount), &dis)
discount = getDiscount(dis, req.Quantity)
}
if discount == 0 {
discount = 1
}
price := sub.UnitPrice * req.Quantity
// discount amount
amount := int64(float64(price) * discount)