From de00eeb45e3aee0cbb5f62210c05ef32bb7478b4 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Tue, 30 Nov 2021 14:22:49 +0800
Subject: [PATCH] fix

---
 src/main/java/com/xcong/excoin/websocket/handler/FishHitWebSocketHandler.java |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/websocket/handler/FishHitWebSocketHandler.java b/src/main/java/com/xcong/excoin/websocket/handler/FishHitWebSocketHandler.java
index 767cc63..2d242e5 100644
--- a/src/main/java/com/xcong/excoin/websocket/handler/FishHitWebSocketHandler.java
+++ b/src/main/java/com/xcong/excoin/websocket/handler/FishHitWebSocketHandler.java
@@ -99,7 +99,7 @@
         // 消耗金币
         BigDecimal consume = (BigDecimal) fortObj;
 
-        MsgModel msg = new MsgModel(consume, fishGold, SID_MID.get(session.getId()));
+        MsgModel msg = new MsgModel(consume, fishGold, SID_MID.get(session.getId()), fortId);
         // 发送打渔消息
         fishHitProducer.sendFishHitMsg(JSONObject.toJSONString(msg));
     }
@@ -110,9 +110,12 @@
 
     @Override
     public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) throws Exception {
+        log.info("离开websocket");
         Long memberId = SID_MID.get(session.getId());
 
+        if (memberId != null) {
+            MEMBER_SESSIONS.remove(memberId);
+        }
         SID_MID.remove(session.getId());
-        MEMBER_SESSIONS.remove(memberId);
     }
 }

--
Gitblit v1.9.1