From 73d287a87764ca33693423a08a58179512372b39 Mon Sep 17 00:00:00 2001 From: wanggeng <450292408@qq.com> Date: Thu, 10 Mar 2022 16:23:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=8E=E4=B8=BA=E8=9E=8D?= =?UTF-8?q?=E5=90=88=E9=80=9A=E4=BF=A1=20=E5=8D=95=E5=91=BC=20->=20?= =?UTF-8?q?=E5=A4=9A=E5=91=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../huaweirtc/impl/HuaweiRtcServiceImpl.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/cn/com/tenlion/usercenter/service/huaweirtc/impl/HuaweiRtcServiceImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/huaweirtc/impl/HuaweiRtcServiceImpl.java index 562a463..c3883d3 100644 --- a/src/main/java/cn/com/tenlion/usercenter/service/huaweirtc/impl/HuaweiRtcServiceImpl.java +++ b/src/main/java/cn/com/tenlion/usercenter/service/huaweirtc/impl/HuaweiRtcServiceImpl.java @@ -9,6 +9,9 @@ import ink.wgink.module.instantmessage.websocket.pojo.WebSocketClientMessage; import ink.wgink.pojo.session.WebSocketSession; import org.springframework.stereotype.Service; +import java.util.Arrays; +import java.util.List; + /** * @ClassName: VideoCallServiceImpl * @Description: 视频通话 @@ -21,12 +24,14 @@ public class HuaweiRtcServiceImpl implements IHuaweiRtcService { @Override public void rtcCall(WebSocketClientMessage webSocketClientMessage) throws UserOfflineException { - String receiverUserId = webSocketClientMessage.getTo(); - WebSocketSession onlineUser = WebSocketChannelManager.getInstance().getOnlineUser(receiverUserId, ISmartCityUserCenterConsts.APP_CLIENT_NAME); - if (onlineUser == null) { - throw new RtcUserOfflineException("用户不在线"); + List receiverUserIds = Arrays.asList(webSocketClientMessage.getTo().split(",")); + List onlineUsers = WebSocketChannelManager.getInstance().listOnlineUser(receiverUserIds, ISmartCityUserCenterConsts.APP_CLIENT_NAME); + if (onlineUsers.isEmpty()) { + throw new RtcUserOfflineException("没有在线用户"); } - WebSocketChannelManager.getInstance().sendText(onlineUser.getChannel(), webSocketClientMessage); + onlineUsers.forEach(onlineUser -> { + WebSocketChannelManager.getInstance().sendText(onlineUser.getChannel(), webSocketClientMessage); + }); } }