From 54328b197d9ac9fee7161a84bba56a723c87360f Mon Sep 17 00:00:00 2001 From: shanshanzhong Date: Tue, 26 May 2026 22:13:40 -0700 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=8A=9F=E8=83=BD(#78):=20=E9=A2=84?= =?UTF-8?q?=E7=AE=97=E8=AE=A2=E5=8D=95=20API=20=E8=BF=94=E5=9B=9E=20promo?= =?UTF-8?q?=5Fdiscount=20=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PreOrderResponse 新增 promo_discount 字段,未接入促销时默认返回 0。 促销命中逻辑待 HIF-76 接入后生效。 Co-authored-by: multica-agent --- apis/types.api | 1 + internal/logic/public/order/preCreateOrderLogic.go | 2 ++ internal/types/types.go | 1 + 3 files changed, 4 insertions(+) diff --git a/apis/types.api b/apis/types.api index 27a5716..5be4d4c 100644 --- a/apis/types.api +++ b/apis/types.api @@ -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"` diff --git a/internal/logic/public/order/preCreateOrderLogic.go b/internal/logic/public/order/preCreateOrderLogic.go index fc07fb0..09415a8 100644 --- a/internal/logic/public/order/preCreateOrderLogic.go +++ b/internal/logic/public/order/preCreateOrderLogic.go @@ -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, diff --git a/internal/types/types.go b/internal/types/types.go index 137a339..cc3e493 100644 --- a/internal/types/types.go +++ b/internal/types/types.go @@ -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"`