release: 报名接口判断是否在报名时间之内

release-2024-04-25
huangyw 1 month ago
parent e472433337
commit 3e7a90efe1

@ -47,6 +47,7 @@ public class ErrorConstants {
// 抽奖部分 // 抽奖部分
public static final String CAN_NOT_EDIT = "不允许修改"; 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_PERIOD = "不是报名中,不允许参与";
public static final String NOT_IN_THE_SIGN_UP_TIME = "不在报名时间之内";
public static final String NOT_MEMBER = "非会员不能参与"; public static final String NOT_MEMBER = "非会员不能参与";
public static final String NOT_PERMANENT_MEMBER = "非永久会员不能参与"; public static final String NOT_PERMANENT_MEMBER = "非永久会员不能参与";
public static final String NOT_CONTRIBUTOR = "非贡献者不能参与"; public static final String NOT_CONTRIBUTOR = "非贡献者不能参与";

@ -351,7 +351,11 @@ public class LotteryService {
// 不是报名中,不允许参与 // 不是报名中,不允许参与
throw new BizException(ErrorConstants.NOT_IN_THE_SIGN_UP_PERIOD); 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(); UserInfo userInfo = userInfoDao.findById(userLoginDto.getUserId()).get();

Loading…
Cancel
Save