From af927dd9b4cf71a11e6b985f4cbebead9b741b4b Mon Sep 17 00:00:00 2001 From: wdvipa Date: Sun, 15 Feb 2026 17:33:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AE=BE=E5=A4=87=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E6=94=B9=E4=B8=BA=E5=85=A8=E9=87=8F=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E5=88=97=E8=A1=A8=E5=B9=BF=E6=92=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - refreshDeviceStatusToWebClients改为广播完整设备列表(devices_list_refresh事件) - 替代原来逐个设备广播device_status_update的方式 - 确保Web端能同步到所有设备的最新状态 --- devices.db | Bin 585728 -> 585728 bytes src/index.ts | 33 ++++++++++----------------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/devices.db b/devices.db index 85884fc2ba5274f694545c539726fed95b90344e..05c56d5b6a9fa59c5e7499db4707545b5742253e 100644 GIT binary patch delta 68 zcmZp8pxp34d4e>fnqFMizP|mIlr1f`9v9KM)Qpc&hp&mR;Gql24;GerpC?d 0) { - this.logger.debug(`🔄 已刷新 ${onlineDevices.length} 个设备状态给 ${webClientCount} 个Web客户端`) + // 获取完整设备列表(含历史设备)并广播给Web端 + const allDevices = this.getAllDevicesIncludingHistory() + if (allDevices.length > 0) { + this.webClientManager.broadcastToAll('devices_list_refresh', { + devices: allDevices, + timestamp: Date.now() + }) + this.logger.debug(`[Refresh] Sent ${allDevices.length} devices to ${webClientCount} web clients`) } } catch (error) { - this.logger.error('刷新设备状态失败:', error) + this.logger.error('refreshDeviceStatusToWebClients failed:', error) } }