修改还未弹窗的优惠卷
This commit is contained in:
parent
055e7d0509
commit
6899cab5b0
@ -166,3 +166,34 @@ func (b *UserCoupon) GetUserUsableMemberCoupon(c *gin.Context) {
|
|||||||
|
|
||||||
responses.OkWithData(userCoupon, c)
|
responses.OkWithData(userCoupon, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PutUserCouponUnnotified 修改还未弹窗的优惠卷
|
||||||
|
func (b *UserCoupon) PutUserCouponUnnotified(c *gin.Context) {
|
||||||
|
userId := c.GetInt64("UserId")
|
||||||
|
|
||||||
|
// 获取数据
|
||||||
|
userCouponDao := dao.UserCouponDao{}
|
||||||
|
maps := make(map[string]interface{})
|
||||||
|
maps["user_id"] = userId
|
||||||
|
userCoupon, _ := userCouponDao.GetUserCoupon(maps)
|
||||||
|
if userCoupon == nil {
|
||||||
|
responses.OkWithData(nil, c)
|
||||||
|
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()
|
||||||
|
|
||||||
|
responses.Ok(c)
|
||||||
|
}
|
||||||
|
|||||||
@ -246,6 +246,9 @@ func privateRouter(r *gin.Engine, api controller.Api) {
|
|||||||
// 获取还未弹窗的优惠卷
|
// 获取还未弹窗的优惠卷
|
||||||
couponGroup.GET("/unnotified", api.UserCoupon.GetUserCouponUnnotified)
|
couponGroup.GET("/unnotified", api.UserCoupon.GetUserCouponUnnotified)
|
||||||
|
|
||||||
|
// 修改还未弹窗的优惠卷
|
||||||
|
couponGroup.PUT("/unnotified/:user_coupon_id", api.UserCoupon.PutUserCouponUnnotified)
|
||||||
|
|
||||||
usableGroup := couponGroup.Group("/usable")
|
usableGroup := couponGroup.Group("/usable")
|
||||||
{
|
{
|
||||||
// 获取患者可使用优惠卷-单项
|
// 获取患者可使用优惠卷-单项
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user