From cdb8297d0f08ebff314ae726c5b21def9887ff75 Mon Sep 17 00:00:00 2001
From: whyclxw <810412026@qq.com>
Date: 星期二, 29 十月 2024 10:25:18 +0800
Subject: [PATCH] websocket默认101全改为从session获取

---
 src/main/java/com/whyc/webSocket/DevStaticSocket.java |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/whyc/webSocket/DevStaticSocket.java b/src/main/java/com/whyc/webSocket/DevStaticSocket.java
index 8dfe49c..a53e68c 100644
--- a/src/main/java/com/whyc/webSocket/DevStaticSocket.java
+++ b/src/main/java/com/whyc/webSocket/DevStaticSocket.java
@@ -5,6 +5,7 @@
 import com.whyc.dto.ResultA200Dto;
 import com.whyc.factory.ThreadPoolExecutorFactory;
 import com.whyc.pojo.db_lithium_ram_db.DevInf;
+import com.whyc.pojo.db_user.UserInf;
 import com.whyc.service.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -53,9 +54,9 @@
     @OnOpen
     public void onOpen(Session session, EndpointConfig config){
         this.httpSession = (HttpSession) config.getUserProperties().get("httpSession");
-        //UserInf user = (UserInf) this.httpSession.getAttribute("user");
-        //final int userId = user.getUid();
-        final int userId = 101;
+        UserInf user = (UserInf) this.httpSession.getAttribute("user");
+        final int userId = user.getUid();
+        //final int userId = 101;
         Thread thread = new Thread() {
             @Override
             public void run() {

--
Gitblit v1.9.1