From fd7dc732ba009ec8aa8308f3270e5ffdf084f2a7 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期三, 05 十一月 2025 15:00:04 +0800
Subject: [PATCH] init

---
 ruoyi-applet/src/main/java/com/ruoyi/web/controller/webSocket/WebSocketTextFrameHandler.java |   64 ++++++++++++++++----------------
 1 files changed, 32 insertions(+), 32 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..6aa6c90 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
@@ -27,8 +27,8 @@
     @Autowired
     private WebSocketUserConnectionManager userConnectionManager;
     
-    @Autowired
-    private WebSocketAuthHandler authHandler;
+//    @Autowired
+//    private WebSocketAuthHandler authHandler;
 
     @Override
     protected void channelRead0(ChannelHandlerContext ctx, TextWebSocketFrame msg) throws Exception {
@@ -63,39 +63,39 @@
     private void handleUserAuth(ChannelHandlerContext ctx, JSONObject messageObj) {
         try {
             // 提取认证信息
-            WebSocketAuthHandler.UserAuthInfo authInfo = authHandler.extractAuthInfo(messageObj);
-            String appUserId = authInfo.getAppUserId();
-            String token = authInfo.getToken();
+//            WebSocketAuthHandler.UserAuthInfo authInfo = authHandler.extractAuthInfo(messageObj);
+//            String appUserId = authInfo.getAppUserId();
+//            String token = authInfo.getToken();
             
-            if (!StringUtils.hasText(appUserId)) {
-                sendAuthFailureResponse(ctx, "用户ID不能为空");
-                return;
-            }
+//            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());
-            }
+//            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