From 0792c2a65171eb7a763ac74cd4546552b7e0c756 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Thu, 27 May 2021 17:21:27 +0800
Subject: [PATCH] modify
---
src/main/java/com/xcong/excoin/netty/logic/WebSocketLogic.java | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/netty/logic/WebSocketLogic.java b/src/main/java/com/xcong/excoin/netty/logic/WebSocketLogic.java
index aec85e6..8511435 100644
--- a/src/main/java/com/xcong/excoin/netty/logic/WebSocketLogic.java
+++ b/src/main/java/com/xcong/excoin/netty/logic/WebSocketLogic.java
@@ -76,10 +76,12 @@
public void sendMsg(RequestBean requestBean) {
String chatStr = requestBean.getData().toString();
+ log.info("接收到的消息:{}", chatStr);
ChatRequest chat = JSONObject.parseObject(chatStr, ChatRequest.class);
Channel channel = ChannelManager.findWebSocketChannel(requestBean.getChannelId());
ResponseBean res = ResponseBean.ok(chat);
+ chat.setTimestamp(System.currentTimeMillis());
res.setType(2);
channel.writeAndFlush(NettyTools.webSocketJson(res));
@@ -90,8 +92,6 @@
ResponseBean toRes = ResponseBean.ok(chat);
res.setType(2);
targetChannel.writeAndFlush(NettyTools.webSocketJson(toRes));
-
- chatProducer.sendMsgHistory(chat);
} else {
// 在redis中保存用户未在线时,给该用户发送的消息条数
String key = AppContants.MSG_NOTICE + chat.getTargetId();
@@ -102,5 +102,6 @@
redisUtils.set(key, Integer.parseInt(value) + 1);
}
}
+ chatProducer.sendMsgHistory(chat);
}
}
--
Gitblit v1.9.1