From f6a912c1a6a26c809568f964941fb4ad4483274e Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Mon, 31 May 2021 11:19:40 +0800
Subject: [PATCH] modify
---
src/main/java/com/xcong/excoin/netty/logic/WebSocketLogic.java | 27 ++++++++++-----------------
1 files changed, 10 insertions(+), 17 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 8384d4b..b2788cb 100644
--- a/src/main/java/com/xcong/excoin/netty/logic/WebSocketLogic.java
+++ b/src/main/java/com/xcong/excoin/netty/logic/WebSocketLogic.java
@@ -42,13 +42,6 @@
responseBean.setType(requestBean.getType());
responseBean.setStatus(1);
-// String bearerToken = requestBean.getData().toString();
-// String rsaToken = bearerToken.replace(AppContants.TOKEN_START_WITH, "");
-// RSA rsa = new RSA(securityProperties.getPrivateKey(), null);
-// String[] tokens = StrUtil.split(rsa.decryptStr(rsaToken, KeyType.PrivateKey), "_");
-//
-// Long memberId = Long.parseLong(tokens[0]);
-
String token = requestBean.getData().toString();
String redisKey = AppContants.APP_LOGIN_PREFIX + token;
String loginStr = redisUtils.getString(redisKey);
@@ -76,6 +69,7 @@
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());
@@ -89,19 +83,18 @@
if (targetChannel != null) {
chat.setIsSelf(2);
ResponseBean toRes = ResponseBean.ok(chat);
- res.setType(2);
+ toRes.setType(2);
targetChannel.writeAndFlush(NettyTools.webSocketJson(toRes));
-
- chatProducer.sendMsgHistory(chat);
} else {
// 在redis中保存用户未在线时,给该用户发送的消息条数
- String key = AppContants.MSG_NOTICE + chat.getTargetId();
- String value = redisUtils.getString(key);
- if (StrUtil.isEmpty(value)) {
- redisUtils.set(key , 1);
- } else {
- redisUtils.set(key, Integer.parseInt(value) + 1);
- }
+// String key = AppContants.MSG_NOTICE + chat.getTargetId();
+// String value = redisUtils.getString(key);
+// if (StrUtil.isEmpty(value)) {
+// redisUtils.set(key , 1);
+// } else {
+// redisUtils.set(key, Integer.parseInt(value) + 1);
+// }
}
+ chatProducer.sendMsgHistory(chat);
}
}
--
Gitblit v1.9.1