fix: 平级踢人后更新被踢设备 online 状态为 false
Some checks failed
Build docker and publish / build (20.15.1) (push) Has been cancelled

unbindDeviceLogic.logoutUnbind 中 KickDevice 后缺少
device.Online = false + UpdateDevice,导致后台仍显示在线

Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
shanshanzhong 2026-03-12 02:37:12 -07:00
parent 384c8df506
commit dddb8c7fe2

View File

@ -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)