From 5a63f232f676ae2aa104838b8aae5ff0e906bdd3 Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Thu, 26 Feb 2026 15:07:47 +0800
Subject: [PATCH] feat:更新反无和工单机构和用户隐藏 新增、删除相关功能

---
 uniapps/work-app/src/utils/websocket.js |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/uniapps/work-app/src/utils/websocket.js b/uniapps/work-app/src/utils/websocket.js
index 5069d25..c9a5a2a 100644
--- a/uniapps/work-app/src/utils/websocket.js
+++ b/uniapps/work-app/src/utils/websocket.js
@@ -5,6 +5,7 @@
     this.connected = false
     this.url = ''
     this.userId = ''
+    this.token = ''
     this.onMessageCallback = null
     this.onOpenCallback = null
     this.onCloseCallback = null
@@ -13,14 +14,15 @@
   }
 
   // 初始化WebSocket连接
-  init(userId, url) {
+  init(userId, url, token) {
     if (!url) {
       console.error('WebSocket初始化失败:缺少url')
       return
     }
 
     this.userId = userId || ''
-    this.url = url + encodeURIComponent(this.userId)
+    this.token = token || ''
+    this.url = url
     this.connect()
   }
 
@@ -29,10 +31,10 @@
     try {
       // 关闭现有连接
       this.close()
-
       // 使用uni-app的WebSocket API
       this.socketTask = uni.connectSocket({
         url: this.url,
+				protocols: [this.token],
         success: () => {
           // console.log('WebSocket连接已请求')
         },
@@ -129,7 +131,7 @@
       if (this.connected) {
         this.send('ping', 'system')
       }
-    }, 2000)
+    }, 25000)
   }
 
   // 停止心跳检测

--
Gitblit v1.9.3