diff --git a/luoo_common/src/main/java/constants/ErrorConstants.java b/luoo_common/src/main/java/constants/ErrorConstants.java index 2dd893a..269cb6c 100644 --- a/luoo_common/src/main/java/constants/ErrorConstants.java +++ b/luoo_common/src/main/java/constants/ErrorConstants.java @@ -61,6 +61,7 @@ public class ErrorConstants { public static final String DRAW_TIME_CANNOT_BE_BEFORE_APPLY_END_TIME = "开奖时间不能在报名结束时间之前"; public static final String APPLY_END_TIME_CANNOT_BE_BEFORE_APPLY_START_TIME = "报名结束时间不能在报名开始时间之前"; public static final String POINT_NOT_ENOUGH = "积分不足"; + public static final String ONLY_ONE_CITY = "只能填写一个城市"; // 积分部分 public static final String DAILY_SIGN_ALREADY = "今日已签到"; 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 b8805be..94895ab 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 @@ -136,6 +136,11 @@ public class LotteryService { throw new BizException(ErrorConstants.TICKET_CITY_IS_REQUIRED); } + // 只能填写一个城市 + if (lotteryRegionList.size() > 1) { + throw new BizException(ErrorConstants.ONLY_ONE_CITY); + } + Integer num = 0; for (LotteryRegion lotteryRegion : lotteryRegionList) { Region regionById = regionService.getRegionById(lotteryRegion.getRegionId()); @@ -207,6 +212,11 @@ public class LotteryService { throw new BizException(ErrorConstants.TICKET_CITY_IS_REQUIRED); } + // 只能填写一个城市 + if (lotteryRegionList.size() > 1) { + throw new BizException(ErrorConstants.ONLY_ONE_CITY); + } + Integer num = 0; lotteryRegionDao.deleteByLotteryId(id);