From 8f6ee4f05216ea242fb4c8f00d1fe0e09ef99889 Mon Sep 17 00:00:00 2001 From: Jolie <412895109@qq.com> Date: Mon, 24 Nov 2025 00:42:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(discover):=20=E4=BF=AE=E5=A4=8D=E8=81=8A?= =?UTF-8?q?=E5=A4=A9=E9=A2=91=E9=81=93ID=E8=8E=B7=E5=8F=96=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 统一使用RTCManager.instance.currentChannelId获取频道ID - 移除冗余的空值判断逻辑 - 确保加入、离开和发送消息功能使用一致的频道标识 --- lib/controller/discover/room_controller.dart | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/controller/discover/room_controller.dart b/lib/controller/discover/room_controller.dart index 08d332b..8f121eb 100644 --- a/lib/controller/discover/room_controller.dart +++ b/lib/controller/discover/room_controller.dart @@ -157,7 +157,7 @@ class RoomController extends GetxController { Future joinChat(CurrentRole role) async { final data = { - 'channelId': rtcChannel.value?.channelId, + 'channelId': RTCManager.instance.currentChannelId, 'seatNumber': role == CurrentRole.maleAudience ? 1 : 2, 'isMicrophoneOn': role != CurrentRole.normalUser ? true : false, 'isVideoOn': @@ -181,7 +181,7 @@ class RoomController extends GetxController { } Future leaveChat() async { - final data = {'channelId': rtcChannel.value?.channelId}; + final data = {'channelId': RTCManager.instance.currentChannelId}; final response = await _networkService.rtcApi.disconnectRtcChannel(data); if (response.data.isSuccess) { isLive = false; @@ -222,8 +222,7 @@ class RoomController extends GetxController { /// 发送公屏消息 Future sendChatMessage(String content) async { - final channelName = - rtcChannel.value?.channelId ?? RTCManager.instance.currentChannelId; + final channelName = RTCManager.instance.currentChannelId; final result = await _messageService.sendMessage( content: content,