From 3e7a90efe1c1f22e219e31cfe19e2af6d17168ef Mon Sep 17 00:00:00 2001 From: huangyw <1207046171@qq.com> Date: Mon, 14 Oct 2024 12:31:27 +0800 Subject: [PATCH] =?UTF-8?q?release:=20=E6=8A=A5=E5=90=8D=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E5=9C=A8=E6=8A=A5=E5=90=8D?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E4=B9=8B=E5=86=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- luoo_common/src/main/java/constants/ErrorConstants.java | 1 + .../src/main/java/com/luoo/user/service/LotteryService.java | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/luoo_common/src/main/java/constants/ErrorConstants.java b/luoo_common/src/main/java/constants/ErrorConstants.java index 77ac9f1..2dd893a 100644 --- a/luoo_common/src/main/java/constants/ErrorConstants.java +++ b/luoo_common/src/main/java/constants/ErrorConstants.java @@ -47,6 +47,7 @@ public class ErrorConstants { // 抽奖部分 public static final String CAN_NOT_EDIT = "不允许修改"; public static final String NOT_IN_THE_SIGN_UP_PERIOD = "不是报名中,不允许参与"; + public static final String NOT_IN_THE_SIGN_UP_TIME = "不在报名时间之内"; public static final String NOT_MEMBER = "非会员不能参与"; public static final String NOT_PERMANENT_MEMBER = "非永久会员不能参与"; public static final String NOT_CONTRIBUTOR = "非贡献者不能参与"; diff --git a/luoo_user/src/main/java/com/luoo/user/service/LotteryService.java b/luoo_user/src/main/java/com/luoo/user/service/LotteryService.java index c52318b..51f76d3 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/LotteryService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/LotteryService.java @@ -351,7 +351,11 @@ public class LotteryService { // 不是报名中,不允许参与 throw new BizException(ErrorConstants.NOT_IN_THE_SIGN_UP_PERIOD); } - + // 判断当前是否在报名时间范围之内 + if (lottery.getApplyStartTime().isAfter(LocalDateTime.now()) || + lottery.getApplyEndTime().isBefore(LocalDateTime.now())) { + throw new BizException(ErrorConstants.NOT_IN_THE_SIGN_UP_TIME); + } // 校验用户是否可参与 UserInfo userInfo = userInfoDao.findById(userLoginDto.getUserId()).get();