Parcourir la source

修改投注逻辑

kk il y a 2 mois
Parent
commit
cc1bb4d9ac

+ 22 - 1
game-business/src/main/java/com/game/business/controller/AppGameBettingController.java

@@ -58,6 +58,9 @@ public class AppGameBettingController extends BaseController{
     @Autowired
     private AppAgentGameBettingTask appAgentGameBettingTask;
 
+    @Autowired
+    private IAppGameMoneyService appGameMoneyService;
+
     @Autowired
     private RedisCache redisCache;
 
@@ -86,6 +89,20 @@ public class AppGameBettingController extends BaseController{
             gameBetting.setBettingGameType(0);
         }
 
+        if(gameBetting.getMoneyId() == null){
+            return HttpRet.fail("金额ID为空。");
+        }
+
+        AppGameMoney appGameMoney = appGameMoneyService.selectAppGameMoneyById(gameBetting.getId());
+
+        if(appGameMoney == null){
+            return HttpRet.fail("金额对象不存在。");
+        }
+
+        if(appGameMoney.getBettingMoney().doubleValue() != gameBetting.getBettingAmount().doubleValue()){
+            return HttpRet.fail("投注金额不匹配,无法下单。");
+        }
+
         AppGameClassify appGameClassify = appGameClassifyService.selectAppGameClassifyById(gameBetting.getClassId());
         if(appGameClassify == null){
             return HttpRet.fail("游戏平台不存在。");
@@ -100,6 +117,10 @@ public class AppGameBettingController extends BaseController{
             return HttpRet.fail("游戏已下线,无法下单。");
         }
 
+        if(appGame.getEnable() == 1){
+            return HttpRet.fail("游戏已禁用,无法下单。");
+        }
+
         if(StringUtils.isBlank(appGame.getGameDate())){
             return HttpRet.fail("游戏期号不存在,无法下单。");
         }
@@ -142,7 +163,7 @@ public class AppGameBettingController extends BaseController{
                 }
             }
 
-            BigDecimal bettingAmountCheck = new BigDecimal("");
+            BigDecimal bettingAmountCheck = new BigDecimal(appGameItem.getBettingMoney() + "");
             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){