瀏覽代碼

Merge remote-tracking branch 'origin/package' into package

zhangxianyu 1 年之前
父節點
當前提交
26cdda0de3

+ 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服务启动成功 <升级commons-io的依赖> ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象Manage服务启动成功 <调试接入线程锁加日志> ( ´・・)ノ(._.`) \n" +
                 "___  ___  ___   _   _   ___  _____  _____ \n" +
                 "|  \\/  | / _ \\ | \\ | | / _ \\|  __ \\|  ___|\n" +
                 "| .  . |/ /_\\ \\|  \\| |/ /_\\ \\ |  \\/| |__  \n" +

+ 0 - 3
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/websocket/KfMsgRedisListener.java

@@ -34,13 +34,11 @@ public class KfMsgRedisListener implements MessageListener {
     public void onMessage(Message message, byte[] pattern) {
         //从redis中拿到的消息
         String messageBody = new String(message.getBody());
-        log.error("redis监听器监听到消息 messageBody : {}", messageBody);
         //转化消息对象
         KfWebSocketMsgDTO kfWebSocketMsgDTO = JsonUtil.toObj(messageBody, KfWebSocketMsgDTO.class);
         Long kfUserId = kfWebSocketMsgDTO.getKfUserId();
         //发送给指定客服
         if (kfUserId != null) {
-            log.error("发送消息给指定客服 kfUserId : {}, kfWebSocketMsgDTO : {}", kfUserId, JsonUtil.toString(kfWebSocketMsgDTO));
             WebSocketSession session = kfMsgWebSocketSessionRegistry.getSession(kfUserId);
             if (session != null && session.isOpen()) {
                 try {
@@ -53,7 +51,6 @@ public class KfMsgRedisListener implements MessageListener {
             return;
         }
         //发送给所有在线客服
-        log.error("发送消息给所有客服 kfWebSocketMsgDTO : {}", JsonUtil.toString(kfWebSocketMsgDTO));
         List<WebSocketSession> openSessions = kfMsgWebSocketSessionRegistry.getAllSessions();
         openSessions.forEach(session -> {
             if (session != null && session.isOpen()) {

+ 6 - 2
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/websocket/KfMsgWebsocketHandler.java

@@ -329,8 +329,10 @@ public class KfMsgWebsocketHandler implements WebSocketHandler {
                 .build());
         //以防锁依然存在, 尝试释放锁, 锁如果不存在, 会抛出异常, 直接捕获不处理
         try {
+            log.error("结束会话释放锁, key : {}", RedisKeyConstant.KF_MSG_USER_CONNECT_JOIN + kfRoom.getOpenId());
             distributedLockComponent.unlock(RedisKeyConstant.KF_MSG_USER_CONNECT_JOIN + kfRoom.getOpenId());
-        } catch (Exception ignored) {
+        } catch (Exception e) {
+            log.error("结束会话释放锁异常, key : {}, e : {}", RedisKeyConstant.KF_MSG_USER_CONNECT_JOIN + kfRoom.getOpenId(), e.getMessage());
         }
     }
 
@@ -388,12 +390,14 @@ public class KfMsgWebsocketHandler implements WebSocketHandler {
         //玩家信息, 判断玩家是否已经被接入
         KfSessionUser kfSessionUser = kfSessionUserService.getById(param.getOpenId());
         if (!kfSessionUser.getIsWait()) {
-            this.sendMessage(session, KfWebSocketMsgDTO.fail(param.getWebSocketMsgType(), "玩家已被其他客服接入"));
+            this.sendMessage(session, KfWebSocketMsgDTO.fail(param.getWebSocketMsgType(), "玩家已被其他客服接入, 非待接入状态"));
             return;
         }
         //触发玩家接入线程锁
+        log.error("玩家接入触发线程锁, key : {}", RedisKeyConstant.KF_MSG_USER_CONNECT_JOIN + param.getOpenId());
         if (!distributedLockComponent.doLock(RedisKeyConstant.KF_MSG_USER_CONNECT_JOIN + param.getOpenId(),
                 0L, 3L, TimeUnit.MINUTES)) {
+            log.error("玩家接入线程锁, 锁定中, key : {}", RedisKeyConstant.KF_MSG_USER_CONNECT_JOIN + param.getOpenId());
             this.sendMessage(session, KfWebSocketMsgDTO.fail(param.getWebSocketMsgType(), "玩家已被其他客服接入"));
             return;
         }

+ 5 - 0
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameServer.java

@@ -99,6 +99,11 @@ public class GameServer implements Serializable {
      */
     private Long updateBy;
 
+    /**
+     * 指派客服ids
+     */
+    private String customerIds;
+
     /**
      * 创建时间
      */