同时在线用户排除房主

This commit is contained in:
tianfeng 2026-03-05 21:02:53 +08:00
parent 75b1fb5dc6
commit 1f5717f090

View File

@ -126,7 +126,14 @@ public class UserHeartbeatListener implements MessageListener {
// 房间内同时在线用户数
if (Objects.equals(roomProfile.getUserId(), event.getUserId())) {
List<LiveRoomUser> liveRoomUsers = liveMicUserCacheService.listUser(roomProfile.getId());
Set<Long> userIdList = liveRoomUsers.stream().map(LiveRoomUser::getUserId).collect(Collectors.toSet());
Set<Long> userIdList = liveRoomUsers.stream()
.map(LiveRoomUser::getUserId)
.filter(userId -> !userId.equals(roomProfile.getUserId()))
.collect(Collectors.toSet());
if (CollectionUtils.isEmpty(userIdList)) {
return;
}
MemberRolesQryCmd roleQry = new MemberRolesQryCmd().setRoomId(roomId).setUserIds(userIdList);
Map<Long, RoomUserRolesEnum> body = roomMemberClient.mapMemberRoles(roleQry).getBody();