From e7742650566220c30491262d34d69ffa4effb366 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期五, 10 七月 2026 09:49:54 +0800
Subject: [PATCH] update
---
ruoyi-applet/src/main/java/com/ruoyi/web/controller/webSocket/WebSocketTextFrameHandler.java | 34 ----------------------------------
1 files changed, 0 insertions(+), 34 deletions(-)
diff --git a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/webSocket/WebSocketTextFrameHandler.java b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/webSocket/WebSocketTextFrameHandler.java
index d53b72a..f57e9ad 100644
--- a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/webSocket/WebSocketTextFrameHandler.java
+++ b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/webSocket/WebSocketTextFrameHandler.java
@@ -62,40 +62,6 @@
*/
private void handleUserAuth(ChannelHandlerContext ctx, JSONObject messageObj) {
try {
- // 提取认证信息
- WebSocketAuthHandler.UserAuthInfo authInfo = authHandler.extractAuthInfo(messageObj);
- String appUserId = authInfo.getAppUserId();
- String token = authInfo.getToken();
-
- if (!StringUtils.hasText(appUserId)) {
- sendAuthFailureResponse(ctx, "用户ID不能为空");
- return;
- }
-
- // 进行用户认证
- WebSocketAuthHandler.AuthResult authResult = authHandler.authenticateUser(appUserId, token);
-
- if (authResult.isSuccess()) {
- // 认证成功,将连接与用户关联
- userConnectionManager.addUserConnection(appUserId, ctx.channel());
-
- // 发送认证成功响应
- JSONObject response = new JSONObject();
- response.put("type", "auth_success");
- response.put("appUserId", appUserId);
- response.put("nickName", authResult.getAppUser().getNickName());
- response.put("message", "认证成功");
- response.put("timestamp", LocalDateTime.now().toString());
-
- ctx.channel().writeAndFlush(new TextWebSocketFrame(response.toJSONString()));
- log.info("用户 {} ({}) 认证成功,ChannelId: {}",
- appUserId, authResult.getAppUser().getNickName(), ctx.channel().id().asLongText());
- } else {
- // 认证失败
- sendAuthFailureResponse(ctx, authResult.getMessage());
- log.warn("用户 {} 认证失败: {}, ChannelId: {}",
- appUserId, authResult.getMessage(), ctx.channel().id().asLongText());
- }
} catch (Exception e) {
log.error("处理用户认证时发生错误", e);
sendAuthFailureResponse(ctx, "认证过程中发生错误: " + e.getMessage());
--
Gitblit v1.7.1