From dddb8c7fe225d413c6bfcfb77381d965ae647086 Mon Sep 17 00:00:00 2001 From: shanshanzhong Date: Thu, 12 Mar 2026 02:37:12 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B9=B3=E7=BA=A7=E8=B8=A2=E4=BA=BA?= =?UTF-8?q?=E5=90=8E=E6=9B=B4=E6=96=B0=E8=A2=AB=E8=B8=A2=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=20online=20=E7=8A=B6=E6=80=81=E4=B8=BA=20false?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit unbindDeviceLogic.logoutUnbind 中 KickDevice 后缺少 device.Online = false + UpdateDevice,导致后台仍显示在线 Co-Authored-By: claude-flow --- internal/logic/public/user/unbindDeviceLogic.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/logic/public/user/unbindDeviceLogic.go b/internal/logic/public/user/unbindDeviceLogic.go index 4139438..327ae9e 100644 --- a/internal/logic/public/user/unbindDeviceLogic.go +++ b/internal/logic/public/user/unbindDeviceLogic.go @@ -202,8 +202,15 @@ func (l *UnbindDeviceLogic) logoutUnbind(userInfo *user.User, device *user.Devic } } - // 6. Kick 设备(缓存已清,重连时 FindOne 会查到最新数据) + // 6. Kick 设备 + 更新在线状态 l.svcCtx.DeviceManager.KickDevice(device.UserId, device.Identifier) + device.Online = false + if updateErr := l.svcCtx.UserModel.UpdateDevice(l.ctx, device); updateErr != nil { + l.Errorw("update device online status failed", + logger.Field("device_id", device.Id), + logger.Field("error", updateErr.Error()), + ) + } // 7. 清除该用户所有 session(旧 token 全部失效) l.clearAllSessions(userInfo.Id)