dos 2 months ago
parent
commit
1dc06bacc2

+ 11 - 4
game-business/src/main/java/com/game/business/controller/AppGameBettingController.java

@@ -127,6 +127,10 @@ public class AppGameBettingController extends BaseController{
             return HttpRet.fail("游戏期号不存在,无法下单。");
         }
 
+        if(!appGame.getGameDate().equals(gameBetting.getGameDate())){
+            return HttpRet.fail("游戏期号不匹配,无法下单。");
+        }
+
         if(StringUtils.isBlank(appGame.getGameTime())){
             return HttpRet.fail("游戏已封盘,无法下单。");
         }
@@ -141,10 +145,13 @@ public class AppGameBettingController extends BaseController{
             return HttpRet.fail("游戏已封盘,无法下单。");
         }
 
+        if(appGame.getBettingCount() == null || appGame.getBettingCount() == 0){
+            return HttpRet.fail("投注次数已超过限额,无法下单。");
+        }
 
-        Integer bettingCount = appGameBettingService.getBettingCount(gameBetting.getUserId(), gameBetting.getGameId(), gameBetting.getGameDate());
-        if(bettingCount != null && bettingCount > 0){
-            if(bettingCount.intValue() > appGame.getBettingCount().intValue()){
+        Integer bettingCount = appGameBettingService.getBettingCount(gameBetting.getUserId(), gameBetting.getGameId(), appGame.getGameDate());
+        if(bettingCount != null && bettingCount > 0 ){
+            if(bettingCount.intValue() >= appGame.getBettingCount().intValue()){
                 return HttpRet.fail("投注次数已超过限额,无法下单。");
             }
         }
@@ -166,7 +173,7 @@ public class AppGameBettingController extends BaseController{
             }
 
             BigDecimal bettingAmountCheck = new BigDecimal(appGameItem.getBettingMoney() + "");
-            BigDecimal bettingAmountSum = appGameBettingService.getBettingAmount(gameBetting.getUserId(), gameBetting.getGameId(), gameBetting.getGameDate(), gameBetting.getBettingItem());
+            BigDecimal bettingAmountSum = appGameBettingService.getBettingAmount(gameBetting.getUserId(), gameBetting.getGameId(), appGame.getGameDate(), gameBetting.getBettingItem());
             BigDecimal bettingAmountAdd = bettingAmountSum.add(new BigDecimal(gameBetting.getBettingAmount() + ""));
             if(bettingAmountAdd.compareTo(bettingAmountCheck) == 1){
                 return HttpRet.fail("投注金额已超过限额,无法下单。");