|
|
|
@@ -352,6 +352,16 @@
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else if(attachment.first == CustomMessageType_Queue && attachment.second == Custom_Message_Sub_Queue_Invite) {
|
|
|
|
|
ArrangeMicUserModel * userInfo = [ArrangeMicUserModel modelWithDictionary:attachment.data];
|
|
|
|
|
if (userInfo.uid.integerValue == [AccountInfoStorage instance].getUid.integerValue) {
|
|
|
|
|
[self headerRefresh];
|
|
|
|
|
}
|
|
|
|
|
} else if(attachment.first == CustomMessageType_Room_PK && attachment.second == Custom_Message_Sub_Room_PK_Manager_Up_Mic) {
|
|
|
|
|
ArrangeMicUserModel * userInfo = [ArrangeMicUserModel modelWithDictionary:[attachment.data objectForKey:[AccountInfoStorage instance].getUid]];
|
|
|
|
|
if (userInfo.uid.integerValue == [AccountInfoStorage instance].getUid.integerValue) {
|
|
|
|
|
[self headerRefresh];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if(message.messageType == NIMMessageTypeNotification) {
|
|
|
|
@@ -547,24 +557,46 @@
|
|
|
|
|
position = [self findLockPosition];
|
|
|
|
|
}
|
|
|
|
|
NSString * uid = userInfo.uid;
|
|
|
|
|
if (position.length > 0 && uid.length > 0) {
|
|
|
|
|
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
|
|
|
|
|
[dic setValue:@(position.integerValue) forKey:@"micPosition"];
|
|
|
|
|
[dic setValue:@(uid.integerValue) forKey:@"uid"];
|
|
|
|
|
AttachmentModel *attachement = [[AttachmentModel alloc]init];
|
|
|
|
|
attachement.first = CustomMessageType_Queue;
|
|
|
|
|
attachement.second = Custom_Message_Sub_Queue_Invite;
|
|
|
|
|
attachement.data = dic;
|
|
|
|
|
|
|
|
|
|
NIMMessage *message = [[NIMMessage alloc]init];
|
|
|
|
|
NIMCustomObject *object = [[NIMCustomObject alloc] init];
|
|
|
|
|
object.attachment = attachement;
|
|
|
|
|
message.messageObject = object;
|
|
|
|
|
//构造会话
|
|
|
|
|
NIMSession *session = [NIMSession session:self.userInfo.roomId type:NIMSessionTypeChatroom];
|
|
|
|
|
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
|
|
|
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
|
|
|
} else {
|
|
|
|
|
if (position.length > 0) {
|
|
|
|
|
if (self.userInfo.type == ArrangeMicType_Room_PK) {
|
|
|
|
|
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
|
|
|
|
|
[dic setValue:position forKey:@"position"];
|
|
|
|
|
[dic setValue:uid forKey:@"uid"];
|
|
|
|
|
[dic setValue:@(userInfo.groupType) forKey:@"groupType"];
|
|
|
|
|
[dic setValue:userInfo.nick forKey:@"nick"];
|
|
|
|
|
AttachmentModel * attachment = [[AttachmentModel alloc] init];
|
|
|
|
|
attachment.first = CustomMessageType_Room_PK;
|
|
|
|
|
attachment.second = Custom_Message_Sub_Room_PK_Manager_Up_Mic;
|
|
|
|
|
attachment.data = @{uid:dic};
|
|
|
|
|
NIMMessage *message = [[NIMMessage alloc]init];
|
|
|
|
|
NIMCustomObject *object = [[NIMCustomObject alloc] init];
|
|
|
|
|
object.attachment = attachment;
|
|
|
|
|
message.messageObject = object;
|
|
|
|
|
//构造会话
|
|
|
|
|
NIMSession *session = [NIMSession session:self.userInfo.roomId type:NIMSessionTypeChatroom];
|
|
|
|
|
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
|
|
|
|
|
} else {
|
|
|
|
|
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
|
|
|
|
|
[dic setValue:@(position.integerValue) forKey:@"micPosition"];
|
|
|
|
|
[dic setValue:@(uid.integerValue) forKey:@"uid"];
|
|
|
|
|
AttachmentModel *attachement = [[AttachmentModel alloc]init];
|
|
|
|
|
attachement.first = CustomMessageType_Queue;
|
|
|
|
|
attachement.second = Custom_Message_Sub_Queue_Invite;
|
|
|
|
|
attachement.data = dic;
|
|
|
|
|
|
|
|
|
|
NIMMessage *message = [[NIMMessage alloc]init];
|
|
|
|
|
NIMCustomObject *object = [[NIMCustomObject alloc] init];
|
|
|
|
|
object.attachment = attachement;
|
|
|
|
|
message.messageObject = object;
|
|
|
|
|
//构造会话
|
|
|
|
|
NIMSession *session = [NIMSession session:self.userInfo.roomId type:NIMSessionTypeChatroom];
|
|
|
|
|
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
|
|
|
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
|
|
|
}
|
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
|
|
[self headerRefresh];
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
[self showErrorToast:@"麦上无空位了"];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|