From f3611088d5980f3be861a86789a0856793026fcf Mon Sep 17 00:00:00 2001 From: chenlin Date: Tue, 21 Jan 2025 09:47:08 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=96=B0=E6=9C=BA=E9=A2=84=E5=94=AE?= =?UTF-8?q?=E5=88=B8=E9=87=91=E9=A2=9D=E4=BC=98=E5=8C=96=EF=BC=8C=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E9=85=8D=E7=BD=AE=E9=87=91=E9=A2=9D=E8=B0=83=E6=95=B4?= =?UTF-8?q?=EF=BC=8C=E4=B8=BA=E7=A9=BA=E5=88=99=E7=AD=89=E4=BA=8E=E5=AE=9E?= =?UTF-8?q?=E9=99=85=E6=94=AF=E4=BB=98=E9=87=91=E9=A2=9D=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/game_card.go | 18 ++++++++++++++++-- model/coupon.go | 4 +++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/controller/game_card.go b/controller/game_card.go index 7d62b4b..ddb2e8b 100644 --- a/controller/game_card.go +++ b/controller/game_card.go @@ -986,6 +986,13 @@ func PushWXPayNotice(c *gin.Context) { return } + var couponValue uint32 + if couponInfo.Value != 0 { // 如果预售券金额为0,则发放时抵扣金额=支付金额;否则=预售券金额 + couponValue = couponInfo.Value + } else { + couponValue = uint32(notifyInfo.TotalFee) + } + couponCode, err := utils.GenerateRandomNumber19() if err != nil { logger.Error("GenerateRandomNumber19err:", err) @@ -996,7 +1003,7 @@ func PushWXPayNotice(c *gin.Context) { CouponType: couponInfo.CouponType, ActivityType: couponInfo.ActivityType, ActivityId: couponInfo.ActivityId, - Value: uint32(notifyInfo.TotalFee), + Value: couponValue, State: 1, ActiveStart: time.Now(), ActiveEnd: time.Now().AddDate(0, 0, 180), @@ -2499,6 +2506,13 @@ func HmPushWXPayNotice(c *gin.Context) { return } + var couponValue uint32 + if couponInfo.Value != 0 { // 如果预售券金额为0,则发放时抵扣金额=支付金额;否则=预售券金额 + couponValue = couponInfo.Value + } else { + couponValue = uint32(fundRecord.Amount) + } + couponCode, err := utils.GenerateRandomNumber19() if err != nil { logger.Error("GenerateRandomNumber19err:", err) @@ -2509,7 +2523,7 @@ func HmPushWXPayNotice(c *gin.Context) { CouponType: couponInfo.CouponType, ActivityType: couponInfo.ActivityType, ActivityId: couponInfo.ActivityId, - Value: uint32(fundRecord.Amount), + Value: couponValue, State: 1, ActiveStart: time.Now(), ActiveEnd: time.Now().AddDate(0, 0, 180), diff --git a/model/coupon.go b/model/coupon.go index 8b00df2..b638e44 100644 --- a/model/coupon.go +++ b/model/coupon.go @@ -34,6 +34,7 @@ type Coupon struct { MemberLevel uint32 `json:"member_level"` // 会员等级 1-用户 2-会员 CategoryNumber string `json:"category_number"` // 可以使用该优惠券的商品分类,如果为空则表示没限制 CommodityNumber string `json:"commodity_number"` // 可以使用该优惠券的商品编号,如果为空则表示没限制 + Limit uint32 `json:"limit"` // 优惠券叠加限制 0-不限制;1-仅限原价购买时使用 IsDraw bool `json:"is_draw" gorm:"-"` // } @@ -59,7 +60,8 @@ type UserCoupon struct { CategoryNumber string `json:"category_number"` // 可以使用该优惠券的商品分类,如果为空则表示没限制 CommodityNumber string `json:"commodity_number"` // 可以使用该优惠券的商品编号,如果为空则表示没限制 Code string `json:"code"` // 优惠券券码 - StoreId uint32 `json:"store_id" gorm:"-"` // 邀请码对应门店id + Limit uint32 `json:"limit"` // 优惠券叠加限制 0-不限制;1-仅限原价购买时使用 + StoreId uint32 `json:"store_id" gorm:"-"` // 邀请码对应门店id Availability uint32 `json:"availability" gorm:"-"` // 1-不可用 2-可用 Coupon *Coupon `json:"coupon" gorm:"-"` }