校验优惠劵及有效期错误

Signed-off-by: Evol郑天 <jpevol@163.com>
pull/78/head
Evol郑天 2023-12-02 09:31:52 +00:00 committed by Gitee
parent 86e3dba268
commit 5aca52388b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 2 additions and 2 deletions

View File

@ -30,7 +30,7 @@ public interface CouponApi {
@Parameter(name = "id", description = "优惠券编号", required = true, example = "1")
CommonResult<Boolean> returnUsedCoupon(@RequestParam("id") Long id);
@GetMapping(PREFIX + "/validate")
@PostMapping(PREFIX + "/validate")
@Operation(summary = "校验优惠劵")
CommonResult<CouponRespDTO> validateCoupon(@Valid CouponValidReqDTO validReqDTO);

View File

@ -70,7 +70,7 @@ public class CouponServiceImpl implements CouponService {
throw exception(COUPON_STATUS_NOT_UNUSED);
}
// 校验有效期;为避免定时器没跑,实际优惠劵已经过期
if (LocalDateTimeUtils.isBetween(coupon.getValidStartTime(), coupon.getValidEndTime())) {
if (!LocalDateTimeUtils.isBetween(coupon.getValidStartTime(), coupon.getValidEndTime())) {
throw exception(COUPON_VALID_TIME_NOT_NOW);
}
}