From 1e7557bd7962b3cb2e93746ec84c793707eb578c Mon Sep 17 00:00:00 2001 From: chenlin Date: Wed, 22 Jan 2025 16:59:04 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=AE=8C=E5=96=84=E5=95=86=E5=9F=8E=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E9=80=80=E8=B4=A7=E6=B5=81=E7=A8=8B=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E6=9C=BA=E9=A2=84=E5=94=AE=E5=88=B8=E9=80=80=E8=B4=A7=E6=97=B6?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=B0=86=E4=BC=98=E6=83=A0=E5=88=B8=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=94=B9=E4=B8=BA4-=E5=B7=B2=E5=A4=B1=E6=95=88?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/models/mall.go | 12 ++++++++++++ app/admin/models/user.go | 16 ++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/app/admin/models/mall.go b/app/admin/models/mall.go index e47b340..39e85d2 100644 --- a/app/admin/models/mall.go +++ b/app/admin/models/mall.go @@ -1365,6 +1365,18 @@ func (r *GoodsOrderRefundSendReceiveReq) Receive() error { log.Error().Msgf("goods stock back err:%#v", err) return err } + if goodsOrder.Amount == 0 { // 目前只有主机预售券可以退款;普通的积分兑换不支持退货 + err = begin.Table("user_coupon").Where("uid = ? and activity_id = ?", goodsOrder.Uid, 10). + Updates(map[string]interface{}{ + "state": 4, + "updated_at": time.Now(), + }).Error + if err != nil { + begin.Rollback() + log.Error().Msgf("update state err:%#v", err) + return err + } + } err = begin.Commit().Error if err != nil { begin.Rollback() diff --git a/app/admin/models/user.go b/app/admin/models/user.go index c59438b..140b61e 100644 --- a/app/admin/models/user.go +++ b/app/admin/models/user.go @@ -213,15 +213,15 @@ const ( // gen:qs type FundRecord struct { Model - Uid uint32 `json:"uid" gorm:"index"` - FundType string `json:"fund_type" gorm:"index"` // -member_gold -member_platinum -member_black_gold - Amount int64 `json:"amount"` + Uid uint32 `json:"uid" gorm:"index"` // + FundType string `json:"fund_type" gorm:"index"` // -member_gold -member_platinum -member_black_gold + Amount int64 `json:"amount"` // TransactionId string `json:"transaction_id" gorm:"index"` // 支付单号 - OutTradeNo string `json:"out_trade_no" gorm:"index"` - RefundId string `json:"refund_id" gorm:"index"` - PaymentNo string `json:"payment_no" gorm:"index"` // 付款单号 - Status uint32 `json:"status"` // 1-待支付 2-已支付 3-已退款 - Remark string `json:"remark"` // 备注 + OutTradeNo string `json:"out_trade_no" gorm:"index"` // + RefundId string `json:"refund_id" gorm:"index"` // + PaymentNo string `json:"payment_no" gorm:"index"` // 付款单号 + Status uint32 `json:"status"` // 1-待支付 2-已支付 3-已退款 + Remark string `json:"remark"` // 备注 // fund_record }