新功能(#78): 预算订单 API 返回 promo_discount 字段
Build docker and publish / build (20.15.1) (push) Has been cancelled
Build docker and publish / build (20.15.1) (pull_request) Successful in 7m54s

PreOrderResponse 新增 promo_discount 字段,未接入促销时默认返回 0。
促销命中逻辑待 HIF-76 接入后生效。

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
2026-05-26 22:13:40 -07:00
parent 5ebfe0a981
commit 54328b197d
3 changed files with 4 additions and 0 deletions
+1
View File
@@ -708,6 +708,7 @@ type (
Price int64 `json:"price"`
Amount int64 `json:"amount"`
Discount int64 `json:"discount"`
PromoDiscount int64 `json:"promo_discount"`
GiftAmount int64 `json:"gift_amount"`
Coupon string `json:"coupon"`
CouponDiscount int64 `json:"coupon_discount"`
@@ -123,6 +123,7 @@ func (l *PreCreateOrderLogic) PreCreateOrder(req *types.PurchaseOrderRequest) (r
amount := int64(math.Round(float64(price) * discount))
discountAmount := price - amount
var promoDiscount int64
var couponAmount int64
if req.Coupon != "" {
couponInfo, err := l.svcCtx.CouponModel.FindOneByCode(l.ctx, req.Coupon)
@@ -185,6 +186,7 @@ func (l *PreCreateOrderLogic) PreCreateOrder(req *types.PurchaseOrderRequest) (r
Price: price,
Amount: amount,
Discount: discountAmount,
PromoDiscount: promoDiscount,
GiftAmount: deductionAmount,
Coupon: req.Coupon,
CouponDiscount: couponAmount,
+1
View File
@@ -2012,6 +2012,7 @@ type PreOrderResponse struct {
Price int64 `json:"price"`
Amount int64 `json:"amount"`
Discount int64 `json:"discount"`
PromoDiscount int64 `json:"promo_discount"`
GiftAmount int64 `json:"gift_amount"`
Coupon string `json:"coupon"`
CouponDiscount int64 `json:"coupon_discount"`