Ver Fonte

游戏配置

kk há 3 meses atrás
pai
commit
0bfe106e81

+ 13 - 19
game-business/src/main/java/com/game/business/task/AppGameBettingTask.java

@@ -62,13 +62,15 @@ public class AppGameBettingTask {
         // 更新倒计时
         if(type == 1){
 
-            JSONArray gameDataArry = null;
+//            JSONArray gameDataArry = null;
+            String gameCode = null;
             String time = null;
             String classCode = null;
             for (int i = 0; i < dataArry.size(); i++) {
                 JSONObject jsonObject = dataArry.getJSONObject(i);
                 if(jsonObject.containsKey("data")){
-                    gameDataArry = jsonObject.getJSONArray("data");
+//                    gameDataArry = jsonObject.getJSONArray("data");
+                    gameCode = jsonObject.getString("id");
                 }
                 if(jsonObject.containsKey("time")){
                     time = jsonObject.getString("time");
@@ -83,7 +85,7 @@ public class AppGameBettingTask {
                 return;
             }
 
-            if(gameDataArry == null){
+            if(gameCode == null){
 //                System.out.println("游戏socket推送倒计时,data对象为空。");
                 return;
             }
@@ -106,24 +108,16 @@ public class AppGameBettingTask {
             }
             Map<String, List<AppGame>> codeGameMap = appGameList.stream().collect(Collectors.groupingBy(AppGame::getCode));
 
-            for (int i = 0; i < gameDataArry.size(); i++) {
-                JSONObject jsonObject = gameDataArry.getJSONObject(i);
-                String gameCode = jsonObject.getString("id");
-                if(gameCode == null){
-//                    System.out.println("游戏socket推送倒计时,游戏id为空。");
-                    continue;
-                }
-                if(!gameCodeFinal.equals(gameCode)){
-                    continue;
-                }
-                if(!codeGameMap.containsKey(gameCode)){
+            if(!gameCodeFinal.equals(gameCode)){
+                return;
+            }
+            if(!codeGameMap.containsKey(gameCode)){
 //                    System.out.println("开奖游戏不存在:" + gameCode);
-                    continue;
-                }
-                AppGame appGame = codeGameMap.get(gameCode).get(0);
-                appGame.setGameTime(time);
-                appGameService.updateAppGame(appGame);
+                return;
             }
+            AppGame appGame = codeGameMap.get(gameCode).get(0);
+            appGame.setGameTime(time);
+            appGameService.updateAppGame(appGame);
             return;
         }