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 48ad7ea..9db3cda 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 @@ -350,6 +350,12 @@ public class LotteryService { // 校验用户是否可参与 UserInfo userInfo = userInfoDao.findById(userLoginDto.getUserId()).get(); + // 已参与抽奖,不能再次参与 + LotteryUser byLotteryIdAndUserId = lotteryUserDao.findByLotteryIdAndUserId(id, userLoginDto.getUserId()); + if(byLotteryIdAndUserId != null) { + throw new BizException(ErrorConstants.ALREADY_PARTICIPATED); + } + Integer participant = lottery.getParticipant(); if (Objects.equals(participant, PointEnums.LOTTERY_ALL_MEMBER.getCode())) { // 会员可参与