From 4dd0447c6f0449c06ca6db9a4316f729e85dd9e1 Mon Sep 17 00:00:00 2001 From: liyuhua <15626451870@163.com> Date: Tue, 12 Mar 2024 20:58:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YuMi/Modules/YMRTC/RtcManager.h | 3 +- .../Model/AcrossRoomPKPanelModel.m | 8 ++--- .../View/SubViews/XPAnchorPkPanelView.m | 8 +++-- .../XPRoomFunctionContainerView.m | 22 +++++++++++++ .../YMRoom/View/StageView/AnchorPKStageView.m | 3 ++ .../Modules/YMRoom/View/StageView/StageView.m | 31 ++++++++++++++++--- 6 files changed, 64 insertions(+), 11 deletions(-) diff --git a/YuMi/Modules/YMRTC/RtcManager.h b/YuMi/Modules/YMRTC/RtcManager.h index 17a4f8e0..4c3dda64 100644 --- a/YuMi/Modules/YMRTC/RtcManager.h +++ b/YuMi/Modules/YMRTC/RtcManager.h @@ -35,7 +35,8 @@ typedef NS_ENUM(NSInteger, BackMusicPlayState) { - ❌ 业务逻辑不要侵入 RctImpl 。 */ @interface RtcManager : NSObject - +///因为跨房pk结束后会闭麦,用这个限制不要关麦 +@property(nonatomic,assign) BOOL isAnckorPk; /** * 是否静音(静别人) * YES:🔇虽然你们麦位上在说话,但是我就是不听。🙉 diff --git a/YuMi/Modules/YMRoom/View/AcrossRoomPK/Model/AcrossRoomPKPanelModel.m b/YuMi/Modules/YMRoom/View/AcrossRoomPK/Model/AcrossRoomPKPanelModel.m index 064e9ca2..00b071bb 100644 --- a/YuMi/Modules/YMRoom/View/AcrossRoomPK/Model/AcrossRoomPKPanelModel.m +++ b/YuMi/Modules/YMRoom/View/AcrossRoomPK/Model/AcrossRoomPKPanelModel.m @@ -18,10 +18,10 @@ @"csRank" : [AcrossRoomPkRankModel class] }; } -///如果一个模型中需要字段映射的话 比如id -> ID name -> other.name -+ (NSDictionary *)replacedKeyFromPropertyName { - return @{@"aMicStatus":@"amicStatus"}; -} +/////如果一个模型中需要字段映射的话 比如id -> ID name -> other.name +//+ (NSDictionary *)replacedKeyFromPropertyName { +// return @{@"aMicStatus":@"amicStatus"}; +//} @end diff --git a/YuMi/Modules/YMRoom/View/AnchorPK/View/SubViews/XPAnchorPkPanelView.m b/YuMi/Modules/YMRoom/View/AnchorPK/View/SubViews/XPAnchorPkPanelView.m index 0cb70976..c4a73756 100644 --- a/YuMi/Modules/YMRoom/View/AnchorPK/View/SubViews/XPAnchorPkPanelView.m +++ b/YuMi/Modules/YMRoom/View/AnchorPK/View/SubViews/XPAnchorPkPanelView.m @@ -527,8 +527,12 @@ } else { self.otherMicButton.hidden = ![pkPanelInfo.cUid isEqualToString:[AccountInfoStorage instance].getUid]; } - self.otherMicButton.selected = pkPanelInfo.aMicStatus == AnchorPKOtherMicStatus_Close; - [[RtcManager instance] muteOne:pkPanelInfo.aMicStatus == AnchorPKOtherMicStatus_Close userId:pkPanelInfo.aUid]; + + [RtcManager instance].isAnckorPk = YES; + self.otherMicButton.selected = pkPanelInfo.aMicStatus == AnchorPKOtherMicStatus_Close; + [[RtcManager instance] muteOne:pkPanelInfo.aMicStatus == AnchorPKOtherMicStatus_Close userId:pkPanelInfo.aUid]; + + } else { self.redCountLabel.text = @"0"; self.blueCountLabel.text = @"0"; diff --git a/YuMi/Modules/YMRoom/View/BaseUIContainerView/XPRoomFunctionContainerView.m b/YuMi/Modules/YMRoom/View/BaseUIContainerView/XPRoomFunctionContainerView.m index 0d27cc30..953447c4 100644 --- a/YuMi/Modules/YMRoom/View/BaseUIContainerView/XPRoomFunctionContainerView.m +++ b/YuMi/Modules/YMRoom/View/BaseUIContainerView/XPRoomFunctionContainerView.m @@ -609,6 +609,10 @@ [Api getAcrossRoomPKDetail:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { if (code == 200) { AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:data.data]; + if (data.data[@"amicStatus"] != nil){ + acrossPKPanelInfo.aMicStatus = [data.data[@"amicStatus"] intValue]; + } + [self updateAnchorPkInfo:acrossPKPanelInfo]; if (acrossPKPanelInfo.pkType == AcrossRoomPkTypeAnchor) { if (acrossPKPanelInfo.aUid.integerValue > 0) { @@ -623,6 +627,9 @@ } } else { AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:data.data]; + if (data.data[@"amicStatus"] != nil){ + acrossPKPanelInfo.aMicStatus = [data.data[@"amicStatus"] intValue]; + } if (acrossPKPanelInfo.aUid.integerValue > 0) { if (!self.acrossPKPanelView.superview) { [self addSubview:self.acrossPKPanelView]; @@ -786,6 +793,9 @@ }]; } AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:attachment.data]; + if (attachment.data[@"amicStatus"] != nil){ + acrossPKPanelInfo.aMicStatus = [attachment.data[@"amicStatus"] intValue]; + } self.acrossPKPanelView.pkPanelInfo = acrossPKPanelInfo; } break; @@ -796,6 +806,9 @@ [self.acrossPKPanelView resetAcrossPKViewData]; [self.acrossPKPanelView removeFromSuperview]; AcrossRoomPKPanelModel * model = [AcrossRoomPKPanelModel modelWithJSON:attachment.data]; + if (attachment.data[@"amicStatus"] != nil){ + model.aMicStatus = [attachment.data[@"amicStatus"] intValue]; + } if (model.isForce) { XPAcrossRoomPKForceEndResultView *view = [[XPAcrossRoomPKForceEndResultView alloc] initWithFrame:CGRectMake(0, 0, 281, 208)]; view.data = model; @@ -837,6 +850,9 @@ NIMChatroomMember * member = [members firstObject]; if (member.type == NIMTeamMemberTypeOwner) { AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:attachment.data]; + if (attachment.data[@"amicStatus"] != nil){ + acrossPKPanelInfo.aMicStatus = [attachment.data[@"amicStatus"] intValue]; + } [[RtcManager instance] connectOtherRoom:acrossPKPanelInfo.aRoomId userId:acrossPKPanelInfo.aUid]; [self updateAnchorPkInfo:acrossPKPanelInfo]; } @@ -881,6 +897,9 @@ }]; } AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:attachment.data]; + if (attachment.data[@"amicStatus"] != nil){ + acrossPKPanelInfo.aMicStatus = [attachment.data[@"amicStatus"] intValue]; + } self.anchorPKPanelView.pkPanelInfo = acrossPKPanelInfo; [self updateAnchorPkInfo:acrossPKPanelInfo]; } @@ -895,6 +914,9 @@ }]; } AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:attachment.data]; + if (attachment.data[@"amicStatus"] != nil){ + acrossPKPanelInfo.aMicStatus = [attachment.data[@"amicStatus"] intValue]; + } self.anchorPKPanelView.pkPanelInfo = acrossPKPanelInfo; [self updateAnchorPkInfo:acrossPKPanelInfo]; if (acrossPKPanelInfo.isForce) { diff --git a/YuMi/Modules/YMRoom/View/StageView/AnchorPKStageView.m b/YuMi/Modules/YMRoom/View/StageView/AnchorPKStageView.m index c16ff7c2..7e2f6e22 100644 --- a/YuMi/Modules/YMRoom/View/StageView/AnchorPKStageView.m +++ b/YuMi/Modules/YMRoom/View/StageView/AnchorPKStageView.m @@ -170,6 +170,9 @@ [Api getAcrossRoomPKDetail:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { if (code == 200) { AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:data.data]; + if (data.data[@"amicStatus"] != nil){ + acrossPKPanelInfo.aMicStatus = [data.data[@"amicStatus"] intValue]; + } if (acrossPKPanelInfo.pkType == AcrossRoomPkTypeAnchor) { self.hostDelegate.getRoomInfo.roundId = acrossPKPanelInfo.roundId; self.hostDelegate.getRoomInfo.pkUid = acrossPKPanelInfo.aUid; diff --git a/YuMi/Modules/YMRoom/View/StageView/StageView.m b/YuMi/Modules/YMRoom/View/StageView/StageView.m index 4644bbc4..852936d1 100644 --- a/YuMi/Modules/YMRoom/View/StageView/StageView.m +++ b/YuMi/Modules/YMRoom/View/StageView/StageView.m @@ -76,7 +76,15 @@ if (self) { _hostDelegate = delegate; _isMiniEnter = NO; - [RtcManager instance].localMuted = YES; + + RoomInfoModel *roomInfo = self.hostDelegate.getRoomInfo; + if (roomInfo.roomModeType != RoomModeType_Open_AcrossRoomPK_mode ){ + NSLog(@"%d",[RtcManager instance].isAnckorPk); + if ([RtcManager instance].isAnckorPk == NO){ + [RtcManager instance].localMuted = YES; + } + + } NSInteger microCount = self.countOfMircoView; for (int i = 0; i < microCount; i++) { UIView* microView = [self microViewForIndex:i]; @@ -278,7 +286,11 @@ if (self.hostDelegate.getUserInfo.uid && model.userInfo.uid == self.hostDelegate.getUserInfo.uid) { selfNeedBroadcast = model.microState.micState == MicroMicStateType_Open; if (model.microState.micState == MicroMicStateType_Close) { - [RtcManager instance].localMuted = YES; + + if (roomInfo.roomModeType != RoomModeType_Open_AcrossRoomPK_mode){ + [RtcManager instance].localMuted = YES; + } + } if (roomInfo.type == RoomType_Anchor && [[AccountInfoStorage instance].getUid isEqualToString:[NSString stringWithFormat:@"%ld", roomInfo.uid]]) { selfNeedBroadcast = YES;///个播房房主默认角色为主播 @@ -497,7 +509,16 @@ RoomInfoModel *roomInfo = self.hostDelegate.getRoomInfo; if (changeType == 2){ if (userInfo.uid == [AccountInfoStorage instance].getUid.integerValue && roomInfo.roomModeType == RoomModeType_Open_Blind){ - [RtcManager instance].localMuted = YES; + if (roomInfo.roomModeType != RoomModeType_Open_AcrossRoomPK_mode ){ + if ([RtcManager instance].isAnckorPk == NO){ + [RtcManager instance].localMuted = YES; + + } + + [RtcManager instance].isAnckorPk = NO; + + + } } }else if (changeType == 1) { // 上麦 MicroQueueModel *sequence = [self.micQueue objectForKey:position]; @@ -531,7 +552,9 @@ if (sequence && sequence.userInfo.uid == [AccountInfoStorage instance].getUid.integerValue) { if (roomInfo.roomModeType != RoomModeType_Open_Blind){ if (userInfo.isNoProhibitMic == NO){ - [RtcManager instance].localMuted = YES; + if (roomInfo.roomModeType != RoomModeType_Open_AcrossRoomPK_mode){ + [RtcManager instance].localMuted = YES; + } } } }