Compare commits

..

2 Commits

Author SHA1 Message Date
fuenmao 9e95286855 优化进入房间http socket 声网调用顺序逻辑 2024-12-26 16:52:17 +08:00
fuenmao 0cf4b4761e 增加房间检测接口 2024-12-26 16:25:14 +08:00
4 changed files with 37 additions and 5 deletions

View File

@ -42,6 +42,12 @@ abstract class RetrofitClient {
@Path("roomNum") String roomNum, @Path("roomNum") String roomNum,
); );
///
@GET("/room/checkout")
Future<BaseStructureResult<bool>> checkout(
@Query("roomNum") String roomNum,
);
/// ///
@GET("/room/user") @GET("/room/user")
Future<BaseStructureResult<List<MeetingRoomUser>>> getMeetingRoomAllUser( Future<BaseStructureResult<List<MeetingRoomUser>>> getMeetingRoomAllUser(

View File

@ -87,4 +87,26 @@ class LoginLogic extends GetxController with RequestToolMixin {
} }
} }
} }
///
Future<void> doHttpCheckMeetingRoom() async {
if(state.meetingCodeController.text.isEmpty){
ToastUtils.showError("请输入会议号");
}else if(state.meetingCodeController.text.length != 8){
ToastUtils.showError("请输入正确的会议号");
}else if(state.nickNameCodeController.text.isEmpty){
ToastUtils.showError("请输入昵称");
}else if(state.checkAgreementBool != true){
ToastUtils.showError("请阅读并勾选相关协议");
}else{
BaseStructureResult<bool> res = await getClient().checkout(state.meetingCodeController.text);
if (null != res.data) {
if(res.data == true){
doHttpAnonymousLogin();
}else{
ToastUtils.showError("房间不存在");
}
}
}
}
} }

View File

@ -378,7 +378,7 @@ class _LoginPageState extends State<LoginPage> {
if (state.pageState.value == 0) { if (state.pageState.value == 0) {
logic.doHttpLogin(); logic.doHttpLogin();
} else { } else {
logic.doHttpAnonymousLogin(); logic.doHttpCheckMeetingRoom();
} }
}, },
) )

View File

@ -55,6 +55,8 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
if (isInit == true) { if (isInit == true) {
signalRSocket(); signalRSocket();
}else{
initRtc();
} }
} }
@ -97,6 +99,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
/// ///
void getMeetingRoomInfo(MeetingRoomInfo meetingRoomInfo) async { void getMeetingRoomInfo(MeetingRoomInfo meetingRoomInfo) async {
state.meetingRoomInfo.value = meetingRoomInfo; state.meetingRoomInfo.value = meetingRoomInfo;
initRtc();
startTime(); startTime();
} }
@ -637,11 +640,13 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
Future<void> joinMeetingToSocket(bool isAgain) async { Future<void> joinMeetingToSocket(bool isAgain) async {
await state.hubConnection.value?.invoke("joinChannel", await state.hubConnection.value?.invoke("joinChannel",
args: [state.roomNumber.value, false, false, false]); args: [state.roomNumber.value, false, false, false]);
if(isAgain == false){ mergeFetch(isAgain);
/*if(isAgain == false){
mergeFetch(isAgain);
initRtc(false); initRtc(false);
}else{ }else{
mergeFetch(true); mergeFetch(true);
} }*/
} }
/// ///
@ -672,7 +677,7 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
/// ------------------------------------------------------------------------------SDK相关 /// ------------------------------------------------------------------------------SDK相关
/// SDK /// SDK
Future<void> initRtc(bool isAgain) async { Future<void> initRtc() async {
// //
PermissionService.requestPermissions(); PermissionService.requestPermissions();
@ -706,7 +711,6 @@ class MeetingMainLogic extends GetxController with RequestToolMixin {
// //
onJoinChannelSuccess: (RtcConnection connection, int elapsed) { onJoinChannelSuccess: (RtcConnection connection, int elapsed) {
state.isJoinSuccess.value = true; state.isJoinSuccess.value = true;
mergeFetch(isAgain);
debugPrint("wgs输出===RTC-自己加入会议室ID${connection.localUid}"); debugPrint("wgs输出===RTC-自己加入会议室ID${connection.localUid}");
}, },