房间踢人逻辑优化
This commit is contained in:
@@ -223,6 +223,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/// @param completion 完成
|
/// @param completion 完成
|
||||||
/// @param roomUid 房间id
|
/// @param roomUid 房间id
|
||||||
+(void)getUnlockRoomAlbumPhotoList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid;
|
+(void)getUnlockRoomAlbumPhotoList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid;
|
||||||
|
///获取踢人列表
|
||||||
|
/// @param completion 完成
|
||||||
|
/// @param roomUid 房间id
|
||||||
|
+(void)getKickUserList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -310,4 +310,11 @@
|
|||||||
+(void)getUnlockRoomAlbumPhotoList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid{
|
+(void)getUnlockRoomAlbumPhotoList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid{
|
||||||
[self makeRequest:@"roomAlbum/listUnlockPhoto" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__,roomUid,nil];
|
[self makeRequest:@"roomAlbum/listUnlockPhoto" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__,roomUid,nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///获取踢人列表
|
||||||
|
/// @param completion 完成
|
||||||
|
/// @param roomUid 房间id
|
||||||
|
+(void)getKickUserList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid{
|
||||||
|
[self makeRequest:@"room/kick/" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__,roomUid,nil];
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
@@ -26,11 +26,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/// @param backPic 房间背景
|
/// @param backPic 房间背景
|
||||||
/// @param mgId 小游戏的id
|
/// @param mgId 小游戏的id
|
||||||
- (void)openRoom:(NSString *)title
|
- (void)openRoom:(NSString *)title
|
||||||
type:(RoomType)type
|
type:(RoomType)type
|
||||||
roomPwd:(NSString *)roomPwd
|
roomPwd:(NSString *)roomPwd
|
||||||
roomDesc:(NSString *)roomDesc
|
roomDesc:(NSString *)roomDesc
|
||||||
backPic:(NSString *)backPic
|
backPic:(NSString *)backPic
|
||||||
mgId:(NSString *)mgId;
|
mgId:(NSString *)mgId;
|
||||||
|
|
||||||
///福袋礼物爆出的礼物的bug
|
///福袋礼物爆出的礼物的bug
|
||||||
///进入房间的时候需要获取一次礼物信息 因为如果有人送礼物的话 如果是福袋礼物的话 爆出的礼物需要从礼物列表中获取 会导致公屏不显示那个礼物
|
///进入房间的时候需要获取一次礼物信息 因为如果有人送礼物的话 如果是福袋礼物的话 爆出的礼物需要从礼物列表中获取 会导致公屏不显示那个礼物
|
||||||
@@ -73,6 +73,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/// 获取已解锁照片id列表
|
/// 获取已解锁照片id列表
|
||||||
/// @param roomUid 房间id
|
/// @param roomUid 房间id
|
||||||
-(void)getUnlockRoomAlbumPhotoListWithRoomUid:(NSString *)roomUid;
|
-(void)getUnlockRoomAlbumPhotoListWithRoomUid:(NSString *)roomUid;
|
||||||
|
///得到踢人名单
|
||||||
|
/// @param roomUid 房间id
|
||||||
|
-(void)getKickUserListWithRoomUid:(NSString *)roomUid;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -297,4 +297,13 @@
|
|||||||
[[self getView]getUnlockRoomAlbumPhotoListSuccessWithList:data.data];
|
[[self getView]getUnlockRoomAlbumPhotoListSuccessWithList:data.data];
|
||||||
} showLoading:NO errorToast:NO] roomUid:roomUid];
|
} showLoading:NO errorToast:NO] roomUid:roomUid];
|
||||||
}
|
}
|
||||||
|
///得到踢人名单
|
||||||
|
/// @param roomUid 房间id
|
||||||
|
-(void)getKickUserListWithRoomUid:(NSString *)roomUid{
|
||||||
|
|
||||||
|
[Api getKickUserList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||||
|
[[self getView]getKickUserListSuccessWithList:data.data];
|
||||||
|
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||||
|
} showLoading:NO errorToast:NO] roomUid:roomUid];
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
@@ -39,6 +39,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
-(void)getFreeGiftDataSuccess:(XPFreeGiftModel *)freeModel;
|
-(void)getFreeGiftDataSuccess:(XPFreeGiftModel *)freeModel;
|
||||||
///获取已解锁照片id列表
|
///获取已解锁照片id列表
|
||||||
-(void)getUnlockRoomAlbumPhotoListSuccessWithList:(NSArray *)list;
|
-(void)getUnlockRoomAlbumPhotoListSuccessWithList:(NSArray *)list;
|
||||||
|
///获取踢人房间列表
|
||||||
|
-(void)getKickUserListSuccessWithList:(NSArray *)list;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -54,6 +54,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/// @param opt 1: 设置为管理员;2:设置普通等级用户;-1:设为黑名单用户;-2:设为禁言用户
|
/// @param opt 1: 设置为管理员;2:设置普通等级用户;-1:设为黑名单用户;-2:设为禁言用户
|
||||||
/// @param isSet true 设置,false 取消设置
|
/// @param isSet true 设置,false 取消设置
|
||||||
+ (void)superAdminHandleUser:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid targetUid:(NSString *)targetUid opt:(NSString *)opt isSet:(NSNumber *)isSet;
|
+ (void)superAdminHandleUser:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid targetUid:(NSString *)targetUid opt:(NSString *)opt isSet:(NSNumber *)isSet;
|
||||||
|
|
||||||
|
/// 记录踢人名单列表
|
||||||
|
/// @param completion 完成
|
||||||
|
/// @param roomUid 房间id
|
||||||
|
/// @param uid 用户id
|
||||||
|
+(void)recordskickUserList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid uid:(NSString *)uid;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -62,5 +62,11 @@
|
|||||||
NSString * fang = [NSString stringFromBase64String:@"c3VwZXIvc2V0L2NoYXRyb29tL3JvbGU="];///super/set/chatroom/role
|
NSString * fang = [NSString stringFromBase64String:@"c3VwZXIvc2V0L2NoYXRyb29tL3JvbGU="];///super/set/chatroom/role
|
||||||
[self makeRequest:fang method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUid, targetUid, opt,isSet, nil];
|
[self makeRequest:fang method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUid, targetUid, opt,isSet, nil];
|
||||||
}
|
}
|
||||||
|
/// 记录踢人名单列表
|
||||||
|
/// @param completion 完成
|
||||||
|
/// @param roomUid 房间id
|
||||||
|
/// @param uid 用户id
|
||||||
|
+(void)recordskickUserList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid uid:(NSString *)uid{
|
||||||
|
[self makeRequest:@"room/kick/" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUid, uid, nil];
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
@@ -89,6 +89,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/// @param opt 1: 设置为管理员;2:设置普通等级用户;-1:设为黑名单用户;-2:设为禁言用户
|
/// @param opt 1: 设置为管理员;2:设置普通等级用户;-1:设为黑名单用户;-2:设为禁言用户
|
||||||
/// @param roomUid 房主的uid
|
/// @param roomUid 房主的uid
|
||||||
- (void)superAdminHandleUser:(NSString *)targetUid opt:(NSString *)opt roomUid:(NSString *)roomUid isSet:(BOOL)isSet;
|
- (void)superAdminHandleUser:(NSString *)targetUid opt:(NSString *)opt roomUid:(NSString *)roomUid isSet:(BOOL)isSet;
|
||||||
|
/// 记录踢人名单列表
|
||||||
|
|
||||||
|
/// @param roomUid 房间id
|
||||||
|
/// @param uid 用户id
|
||||||
|
-(void)recordsKickUserListWithRoomUid:(NSString *)roomUid uid:(NSString *)uid;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -451,7 +451,7 @@
|
|||||||
[[NIMSDK sharedSDK].chatroomManager kickMember:request completion:^(NSError * _Nullable error) {
|
[[NIMSDK sharedSDK].chatroomManager kickMember:request completion:^(NSError * _Nullable error) {
|
||||||
|
|
||||||
|
|
||||||
[[self getView] makeKickUserFinish:error];
|
[[self getView] makeKickUserFinish:error uid:targetUid];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -602,7 +602,16 @@
|
|||||||
return nil;
|
return nil;
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
/// 记录踢人名单列表
|
||||||
|
/// @param roomUid 房间id
|
||||||
|
/// @param uid 用户id
|
||||||
|
-(void)recordsKickUserListWithRoomUid:(NSString *)roomUid uid:(NSString *)uid{
|
||||||
|
[Api recordskickUserList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||||
|
|
||||||
|
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||||
|
|
||||||
|
} showLoading:NO errorToast:NO] roomUid:roomUid uid:uid ];
|
||||||
|
}
|
||||||
#pragma mark - Getters And Setters
|
#pragma mark - Getters And Setters
|
||||||
- (NSMutableArray *)functionArray {
|
- (NSMutableArray *)functionArray {
|
||||||
if (!_functionArray) {
|
if (!_functionArray) {
|
||||||
|
@@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
///设置管理 取消管理员 成功
|
///设置管理 取消管理员 成功
|
||||||
- (void)markUserManagerFinish:(XPUserCardItemModel *)item error:(NSError *)error;
|
- (void)markUserManagerFinish:(XPUserCardItemModel *)item error:(NSError *)error;
|
||||||
/// 踢出房间
|
/// 踢出房间
|
||||||
- (void)makeKickUserFinish:(NSError *)error;
|
- (void)makeKickUserFinish:(NSError *)error uid:(NSString *)uid;
|
||||||
///超管踢管理出房间
|
///超管踢管理出房间
|
||||||
- (void)superAdminKickUserFinish:(NSError *)error;
|
- (void)superAdminKickUserFinish:(NSError *)error;
|
||||||
///抱下麦成功
|
///抱下麦成功
|
||||||
|
@@ -643,10 +643,12 @@
|
|||||||
[self.collectionView reloadData];
|
[self.collectionView reloadData];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)makeKickUserFinish:(NSError *)error {
|
- (void)makeKickUserFinish:(NSError *)error uid:(NSString *)uid{
|
||||||
if (error == nil && self.targetUserInfo) {
|
if (error == nil && self.targetUserInfo) {
|
||||||
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.uid];
|
||||||
[self dismissViewControllerAnimated:YES completion:nil];
|
[self dismissViewControllerAnimated:YES completion:nil];
|
||||||
[self sendCustomMessageKickOrBlackUser:CustomMessageType_Kick_User second:Custom_Message_Sub_Kick_BeKicked];
|
[self sendCustomMessageKickOrBlackUser:CustomMessageType_Kick_User second:Custom_Message_Sub_Kick_BeKicked];
|
||||||
|
[self.presenter recordsKickUserListWithRoomUid:roomUid uid:uid];
|
||||||
} else if (error.code == 404) {
|
} else if (error.code == 404) {
|
||||||
[self showErrorToast:YMLocalizedString(@"XPUserCardViewController0")];
|
[self showErrorToast:YMLocalizedString(@"XPUserCardViewController0")];
|
||||||
}
|
}
|
||||||
|
@@ -1001,7 +1001,18 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
}
|
}
|
||||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kGetgetUnlockRoomAlbumPhotoListNot" object:nil];
|
[[NSNotificationCenter defaultCenter]postNotificationName:@"kGetgetUnlockRoomAlbumPhotoListNot" object:nil];
|
||||||
}
|
}
|
||||||
|
///获取踢人房间列表
|
||||||
|
-(void)getKickUserListSuccessWithList:(NSArray *)list{
|
||||||
|
NSString *uid = [[AccountInfoStorage instance]getUid];
|
||||||
|
for (id obj in list) {
|
||||||
|
if([obj integerValue] == [uid integerValue]){
|
||||||
|
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPRoomViewController0")];
|
||||||
|
[self dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
- (void)initEnterRoomSuccess:(RoomInfoModel *)roomInfo user:(UserInfoModel *)userInfo {
|
- (void)initEnterRoomSuccess:(RoomInfoModel *)roomInfo user:(UserInfoModel *)userInfo {
|
||||||
[XNDJTDDLoadingTool hideHUDInView:self.navigationController.view];
|
[XNDJTDDLoadingTool hideHUDInView:self.navigationController.view];
|
||||||
[XPSkillCardPlayerManager shareInstance].roomUid = @(roomInfo.uid).stringValue;
|
[XPSkillCardPlayerManager shareInstance].roomUid = @(roomInfo.uid).stringValue;
|
||||||
@@ -1019,14 +1030,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//判断5分钟内是否被踢出过房间
|
|
||||||
NSString *currentUid = [AccountInfoStorage instance].getUid;
|
|
||||||
NSString *key = [NSString stringWithFormat:@"kKickedOutRoom_%@_%ld", currentUid, roomInfo.uid];
|
|
||||||
if ([self isKictOutLatest:key mainKey:@"kKickedOutRoomList"] == YES) {
|
|
||||||
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPRoomViewController0")];
|
|
||||||
[self dismissViewControllerAnimated:YES completion:nil];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (roomInfo.type == RoomType_Anchor) {//个播房,获取下一个房间
|
if (roomInfo.type == RoomType_Anchor) {//个播房,获取下一个房间
|
||||||
[self handleInitAnchorRoom];
|
[self handleInitAnchorRoom];
|
||||||
[self showAnchorScrollTipView];
|
[self showAnchorScrollTipView];
|
||||||
@@ -1391,33 +1395,8 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
|
|
||||||
#pragma mark - NIMChatroomManagerDelegate
|
#pragma mark - NIMChatroomManagerDelegate
|
||||||
- (void)chatroomBeKicked:(NIMChatroomBeKickedResult *)result {
|
- (void)chatroomBeKicked:(NIMChatroomBeKickedResult *)result {
|
||||||
if (result.reason == 2) {
|
|
||||||
[self showErrorToast:YMLocalizedString(@"XPRoomViewController8")];
|
|
||||||
///保存被踢出时的时间
|
|
||||||
NSDate* date = [NSDate dateWithTimeIntervalSinceNow:0];//获取当前时间0秒后的时间
|
|
||||||
NSTimeInterval time = [date timeIntervalSince1970];
|
|
||||||
NSString *currentTime = [NSString stringWithFormat:@"%.0f", time];
|
|
||||||
NSString *key = [NSString stringWithFormat:@"kKickedOutRoom_%@_%ld", [AccountInfoStorage instance].getUid, self.roomInfo.uid];
|
|
||||||
|
|
||||||
NSMutableDictionary *kickedList = [[NSUserDefaults standardUserDefaults]valueForKey:@"kKickedOutRoomList"];
|
if (result.reason == 5) {
|
||||||
if([kickedList isKindOfClass:[NSString class]]){
|
|
||||||
kickedList = nil;
|
|
||||||
}
|
|
||||||
if(kickedList == nil){
|
|
||||||
kickedList = [NSMutableDictionary dictionary];
|
|
||||||
}else{
|
|
||||||
kickedList = [[NSMutableDictionary alloc]initWithDictionary:kickedList];
|
|
||||||
}
|
|
||||||
NSMutableDictionary *copyList = [[NSMutableDictionary alloc]initWithDictionary:kickedList];
|
|
||||||
for (NSString *timeKey in copyList.allKeys) {
|
|
||||||
if([self isKictOutLatest:timeKey mainKey:@"kKickedOutRoomList"] == NO){
|
|
||||||
[kickedList removeObjectForKey:timeKey];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
[kickedList setValue:currentTime forKey:key];
|
|
||||||
[[NSUserDefaults standardUserDefaults] setObject:kickedList forKey:@"kKickedOutRoomList"];
|
|
||||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
||||||
} else if (result.reason == 5) {
|
|
||||||
[self showErrorToast:YMLocalizedString(@"XPRoomViewController9")];
|
[self showErrorToast:YMLocalizedString(@"XPRoomViewController9")];
|
||||||
}
|
}
|
||||||
[self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]];
|
[self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]];
|
||||||
@@ -1548,9 +1527,14 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
break;
|
break;
|
||||||
case NIMChatroomEventTypeEnter:
|
case NIMChatroomEventTypeEnter:
|
||||||
{
|
{
|
||||||
|
if (content.source.userId.integerValue == [AccountInfoStorage instance].getUid.integerValue){
|
||||||
|
[self.presenter getKickUserListWithRoomUid:@(self.roomInfo.uid).stringValue];
|
||||||
|
}
|
||||||
if (content.source.userId.integerValue != [AccountInfoStorage instance].getUid.integerValue && self.userInfo.platformRole != 1) {
|
if (content.source.userId.integerValue != [AccountInfoStorage instance].getUid.integerValue && self.userInfo.platformRole != 1) {
|
||||||
onLineNumber += 1;
|
onLineNumber += 1;
|
||||||
}else {///如果是自己的话 如果有坐骑的话
|
}else {
|
||||||
|
|
||||||
|
///如果是自己的话 如果有坐骑的话
|
||||||
[self userEnterRoomSuccess];
|
[self userEnterRoomSuccess];
|
||||||
///在活动页面 判断是否显示 相亲加入的按钮 所以需要等用户进房成功之后才能获取 房间角色
|
///在活动页面 判断是否显示 相亲加入的按钮 所以需要等用户进房成功之后才能获取 房间角色
|
||||||
[self.activityContainerView onRoomUpdate];
|
[self.activityContainerView onRoomUpdate];
|
||||||
|
Reference in New Issue
Block a user