From 055e7d050963d070a77ec39bec44bf48941779be Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Mon, 2 Sep 2024 14:21:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=BF=98=E6=9C=AA=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E7=9A=84=E4=BC=98=E6=83=A0=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/controller/UserCoupon.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/api/controller/UserCoupon.go b/api/controller/UserCoupon.go index e021d92..8ab6984 100644 --- a/api/controller/UserCoupon.go +++ b/api/controller/UserCoupon.go @@ -83,6 +83,20 @@ func (b *UserCoupon) GetUserCouponUnnotified(c *gin.Context) { return } + // 开始事务 + tx := global.Db.Begin() + defer func() { + if r := recover(); r != nil { + tx.Rollback() + } + }() + + maps = make(map[string]interface{}) + maps["is_windows"] = 1 + _ = userCouponDao.EditUserCouponById(tx, userCoupon.UserCouponId, maps) + + tx.Commit() + // 处理返回值 g := dto.GetUserCouponDto(userCoupon)