From 8bcb3e74b64ac8a2967394637beb992ecdbe79ec Mon Sep 17 00:00:00 2001 From: CrescentLeaf Date: Sun, 21 Sep 2025 16:13:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9C=8D=E5=8B=99=E7=AB=AF=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E7=8D=B2=E5=8F=96=E6=AF=8F=E5=80=8B=E5=AE=A2=E6=88=B6?= =?UTF-8?q?=E7=AB=AF=E7=9A=84=E9=80=A3=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/api/ApiManager.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/api/ApiManager.ts b/server/api/ApiManager.ts index 3b29cc9..0ebd6a3 100644 --- a/server/api/ApiManager.ts +++ b/server/api/ApiManager.ts @@ -33,8 +33,11 @@ export default class ApiManager { this.event_listeners[name] = func } static clients: { [key: string]: { [key: string]: SocketIo.Socket } } = {} - static checkUserIsOnline(userId: string, deviceId: string) { - return this.clients[userId]?.[deviceId] != null + static checkUserIsOnline(userId: string) { + return this.getUserClientSockets(userId) != null + } + static getUserClientSockets(userId: string) { + return this.clients[userId] } static initEvents() { const io = this.socketIoServer