废弃,不进行检测是否已发放
This commit is contained in:
parent
575c93bb73
commit
7dbab928bb
@ -73,6 +73,10 @@ func (r *CouponService) AddSystemCoupon(req requests.AddSystemCoupon) (bool, err
|
||||
if *req.WithAmount == 0 {
|
||||
return false, errors.New("请填入符合满减标准金额")
|
||||
}
|
||||
|
||||
if *req.WithAmount > *req.CouponPrice {
|
||||
return false, errors.New("满减标准金额不可超过优惠卷金额")
|
||||
}
|
||||
}
|
||||
|
||||
// 数量
|
||||
@ -571,14 +575,15 @@ func (r *CouponService) GrantSystemCoupon(couponId, adminUserId int64, req reque
|
||||
// 检测用户是否已领取该优惠卷
|
||||
userCouponDao := dao.UserCouponDao{}
|
||||
|
||||
maps = make(map[string]interface{})
|
||||
maps["user_id"] = user.UserId
|
||||
maps["coupon_id"] = coupon.CouponId
|
||||
maps["user_coupon_status"] = 0
|
||||
userCoupons, _ := userCouponDao.GetUserCouponList(maps)
|
||||
if len(userCoupons) >= req.SingleQuantity {
|
||||
return false, errors.New("用户已有该优惠卷")
|
||||
}
|
||||
//// 废弃,不进行检测是否已发放
|
||||
//maps = make(map[string]interface{})
|
||||
//maps["user_id"] = user.UserId
|
||||
//maps["coupon_id"] = coupon.CouponId
|
||||
//maps["user_coupon_status"] = 0
|
||||
//userCoupons, _ := userCouponDao.GetUserCouponList(maps)
|
||||
//if len(userCoupons) >= req.SingleQuantity {
|
||||
// return false, errors.New("用户已有该优惠卷")
|
||||
//}
|
||||
|
||||
// 开始事务
|
||||
tx := global.Db.Begin()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user