ソースを参照

feat : 新增游戏和区服rpc接口01

bilingfeng 11 ヶ月 前
コミット
d7e031559e

+ 40 - 2
game-module/game-module-base/src/main/java/com/zanxiang/game/module/base/pojo/dto/GameServerDTO.java

@@ -30,7 +30,45 @@ public class GameServerDTO implements Serializable {
     public List<SuperGameServerBean> superGameServerList;
 
     /**
-     * 通过游戏id,区服id获取区服
+     * 通过游戏id获取原始区服
+     *
+     * @param gameId : 游戏id
+     * @return : 返回区服信息
+     */
+    public List<GameServerBean> getAllGameServerByGameId(Long gameId) {
+        if (CollectionUtils.isEmpty(this.superGameServerList)) {
+            return null;
+        }
+        SuperGameServerBean superGameServer = this.superGameServerList.stream()
+                .filter(superGameServerBean -> superGameServerBean.getGameIdList().contains(gameId))
+                .findFirst().orElse(null);
+        if (superGameServer == null) {
+            return null;
+        }
+        return superGameServer.getSourceGameServerList();
+    }
+
+    /**
+     * 通过超父游戏id获取原始区服
+     *
+     * @param superGameId : 超父游戏id
+     * @return : 返回区服信息
+     */
+    public List<GameServerBean> getAllGameServerBySupperGameId(Long superGameId) {
+        if (CollectionUtils.isEmpty(this.superGameServerList)) {
+            return null;
+        }
+        SuperGameServerBean superGameServer = this.superGameServerList.stream()
+                .filter(superGameServerBean -> Objects.equals(superGameId, superGameServerBean.getSuperGameId()))
+                .findFirst().orElse(null);
+        if (superGameServer == null) {
+            return null;
+        }
+        return superGameServer.getSourceGameServerList();
+    }
+
+    /**
+     * 通过游戏id,区服id获取原始区服
      *
      * @param gameId   : 游戏id
      * @param serverId : 区服id
@@ -52,7 +90,7 @@ public class GameServerDTO implements Serializable {
     }
 
     /**
-     * 通过游戏id,区服id获取区服
+     * 通过游戏id,区服id获取原始区服
      *
      * @param superGameId : 超父游戏id
      * @param serverId    : 区服id

+ 1 - 1
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/ManageApplication.java

@@ -23,7 +23,7 @@ public class ManageApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(ManageApplication.class, args);
-        System.out.println("赞象Manage服务启动成功 < (新增游戏和区服rpc接口´・・)ノ(._.`) \n" +
+        System.out.println("赞象Manage服务启动成功 < (新增游戏和区服rpc接口01´・・)ノ(._.`) \n" +
                 "___  ___  ___   _   _   ___  _____  _____ \n" +
                 "|  \\/  | / _ \\ | \\ | | / _ \\|  __ \\|  ___|\n" +
                 "| .  . |/ /_\\ \\|  \\| |/ /_\\ \\ |  \\/| |__  \n" +