Browse Source

修改投注逻辑

kk 3 tuần trước cách đây
mục cha
commit
5d97f3f90f

+ 7 - 2
game-business/src/main/java/com/game/business/controller/AppGameBettingController.java

@@ -120,6 +120,11 @@ public class AppGameBettingController extends BaseController{
 
 
         Integer bettingCount = appGameBettingService.getBettingCount(gameBetting.getUserId(), gameBetting.getGameId(), gameBetting.getGameDate());
+        if(bettingCount != null && bettingCount > 0){
+            if(bettingCount.intValue() > appGame.getBettingCount().intValue()){
+                return HttpRet.fail("投注次数已超过限额,无法下单。");
+            }
+        }
 
         // 单选
         if(gameBetting.getBettingGameType() == 0){
@@ -137,11 +142,11 @@ public class AppGameBettingController extends BaseController{
                 }
             }
 
-            BigDecimal bettingAmountCheck = new BigDecimal("0");
+            BigDecimal bettingAmountCheck = new BigDecimal("");
             BigDecimal bettingAmountSum = appGameBettingService.getBettingAmount(gameBetting.getUserId(), gameBetting.getGameId(), gameBetting.getGameDate(), gameBetting.getBettingItem());
             BigDecimal bettingAmountAdd = bettingAmountSum.add(new BigDecimal(gameBetting.getBettingAmount() + ""));
             if(bettingAmountAdd.compareTo(bettingAmountCheck) == 1){
-                return HttpRet.fail("游戏选项当前期投注金额已超过限额,无法下单。");
+                return HttpRet.fail("投注金额已超过限额,无法下单。");
             }
 
             gameBetting.setBettingMultiple(appGameItem.getItemMultiple());