麦上有人时不能再上麦

This commit is contained in:
chenguilong
2022-09-15 16:21:03 +08:00
parent 1ce16bae62
commit c89b0ebc73

View File

@@ -60,6 +60,8 @@
* *
*/ */
@property (nonatomic, assign) BOOL isUpingMic; @property (nonatomic, assign) BOOL isUpingMic;
///,
@property (nonatomic, assign) BOOL hadGetQueueInfoSuccess;
@end @end
@@ -151,7 +153,7 @@
} }
[self microQueueUpdated: NO]; [self microQueueUpdated: NO];
}]; }];
self.hadGetQueueInfoSuccess = NO;
// self.micQueue // self.micQueue
[[NIMSDK sharedSDK].chatroomManager fetchChatroomQueue:[NSString stringWithFormat:@"%ld", (long)roomInfo.roomId] completion:^(NSError * _Nullable error, NSArray<NSDictionary<NSString *,NSString *> *> * _Nullable info) { [[NIMSDK sharedSDK].chatroomManager fetchChatroomQueue:[NSString stringWithFormat:@"%ld", (long)roomInfo.roomId] completion:^(NSError * _Nullable error, NSArray<NSDictionary<NSString *,NSString *> *> * _Nullable info) {
if (error) return; if (error) return;
@@ -167,6 +169,7 @@
} }
[self microQueueUpdated:ownerRTCChange]; [self microQueueUpdated:ownerRTCChange];
[self.hostDelegate onMicroQueueUpdate:self.micQueue]; [self.hostDelegate onMicroQueueUpdate:self.micQueue];
self.hadGetQueueInfoSuccess = YES;
}]; }];
// //
@@ -534,6 +537,14 @@
if (!member) return; if (!member) return;
void(^nimUpQueue)(NSString*, BOOL) = ^ (NSString* up, BOOL isFromDownMic){ void(^nimUpQueue)(NSString*, BOOL) = ^ (NSString* up, BOOL isFromDownMic){
if (!self.hadGetQueueInfoSuccess) {
return;
}
MicroQueueModel* micModel = [self.micQueue objectForKey:up];
if (micModel.userInfo) {///,
[XCHUDTool showErrorWithMessage:@"该麦位已经有人了哦~"];
return;
}
NIMChatroomQueueUpdateRequest *request = [[NIMChatroomQueueUpdateRequest alloc]init]; NIMChatroomQueueUpdateRequest *request = [[NIMChatroomQueueUpdateRequest alloc]init];
request.key = up; request.key = up;
request.value = [[self userInfoToQueueExt:userInfo] toJSONString]; request.value = [[self userInfoToQueueExt:userInfo] toJSONString];