1、新机预售券金额优化,根据配置金额调整,为空则等于实际支付金额;

This commit is contained in:
chenlin 2025-01-21 09:47:08 +08:00
parent 04090fba93
commit f3611088d5
2 changed files with 19 additions and 3 deletions

View File

@ -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),

View File

@ -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,6 +60,7 @@ type UserCoupon struct {
CategoryNumber string `json:"category_number"` // 可以使用该优惠券的商品分类,如果为空则表示没限制
CommodityNumber string `json:"commodity_number"` // 可以使用该优惠券的商品编号,如果为空则表示没限制
Code string `json:"code"` // 优惠券券码
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:"-"`