From f5e6133809c553cfd9fb28ee61019927c547c374 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Wed, 08 Dec 2021 15:58:33 +0800
Subject: [PATCH] 20211208  fish

---
 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