优惠卷
This commit is contained in:
parent
7dbab928bb
commit
859c9f56d0
@ -509,13 +509,6 @@ func (r *CouponService) GrantSystemCoupon(couponId, adminUserId int64, req reque
|
|||||||
return false, errors.New("优惠卷非正常状态,不支持发放")
|
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
|
remainingQuantity := coupon.CouponCount - coupon.CouponTakeCount
|
||||||
if remainingQuantity <= 0 {
|
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)
|
now = now.Add(time.Minute * 10)
|
||||||
if coupon.ValidType == 1 {
|
if coupon.ValidType == 1 {
|
||||||
// 1:绝对时效
|
// 1:绝对时效
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user