优惠卷

This commit is contained in:
wucongxing8150 2024-06-07 08:40:14 +08:00
parent 7dbab928bb
commit 859c9f56d0

View File

@ -509,13 +509,6 @@ func (r *CouponService) GrantSystemCoupon(couponId, adminUserId int64, req reque
return false, errors.New("优惠卷非正常状态,不支持发放")
}
// 检测订单过期时间
now := time.Now()
validEndTime := time.Time(*coupon.ValidEndTime)
if now.After(validEndTime) {
return false, errors.New("优惠卷已过期,不支持发放")
}
// 检测优惠卷剩余数量
remainingQuantity := coupon.CouponCount - coupon.CouponTakeCount
if remainingQuantity <= 0 {
@ -528,6 +521,7 @@ func (r *CouponService) GrantSystemCoupon(couponId, adminUserId int64, req reque
}
// 检测优惠卷过期时间
now := time.Now()
now = now.Add(time.Minute * 10)
if coupon.ValidType == 1 {
// 1:绝对时效