Browse Source

禁止连麦

Steven 2 years ago
parent
commit
5e12bd9770

BIN
KulexiuForTeacher/KulexiuForTeacher.xcworkspace/xcuserdata/wangzhi.xcuserdatad/UserInterfaceState.xcuserstate


+ 68 - 4
KulexiuForTeacher/KulexiuForTeacher.xcworkspace/xcuserdata/wangzhi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -62,8 +62,8 @@
             filePath = "KulexiuForTeacher/Module/Live/Controller/LiveRoomViewController.m"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1685"
-            endingLineNumber = "1685"
+            startingLineNumber = "1675"
+            endingLineNumber = "1675"
             landmarkName = "-pauseLiveActionBack:"
             landmarkType = "7">
          </BreakpointContent>
@@ -94,11 +94,75 @@
             filePath = "KulexiuForTeacher/Module/Live/Controller/LiveRoomViewController.m"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1423"
-            endingLineNumber = "1423"
+            startingLineNumber = "1413"
+            endingLineNumber = "1413"
             landmarkName = "-sendMessage:displayMessage:callback:"
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "6DA8A69E-BC2E-4029-9928-61E5BC372649"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "KulexiuForTeacher/Common/Base/KSNetworkingManager.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "1340"
+            endingLineNumber = "1340"
+            landmarkName = "+liveRoomSetMicApplyEnable:roomUid:whetherMic:success:faliure:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "36223C7F-0739-4CEA-9F63-F89D02C1CE38"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "KulexiuForTeacher/Module/Live/View/SeatListView/LiveSeatActionView.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "112"
+            endingLineNumber = "112"
+            landmarkName = "-setIsForbiddenApply:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "4A43969F-0FC5-4174-9B84-1A37793F2609"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "KulexiuForTeacher/Module/Live/View/SeatListView/LiveSeatActionView.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "155"
+            endingLineNumber = "155"
+            landmarkName = "-pagerView:initListAtIndex:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "DE44E28C-811C-4342-B9D6-92D797B7E3DD"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "KulexiuForTeacher/Module/Live/View/SeatListView/LiveApplyControlView.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "68"
+            endingLineNumber = "68"
+            landmarkName = "-setIsForbiddenApply:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>

+ 8 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSNetworkingManager.h

@@ -655,6 +655,14 @@ NS_ASSUME_NONNULL_BEGIN
 /// @param faliure 失败
 + (void)speakerCheckRoomInfoRequest:(NSString *)get roomUid:(NSString *)roomUid success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
 
+/// 置是否允许连麦
+/// @param get get
+/// @param roomUid 房间id
+/// @param whetherMic 是否连麦 0:是 1否
+/// @param success 成功
+/// @param faliure 失败
++ (void)liveRoomSetMicApplyEnable:(NSString *)get roomUid:(NSString *)roomUid whetherMic:(NSInteger)whetherMic success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
+
 // 进入直播房间
 // /api-teacher/liveRoom/speakerJoinRoom
 

+ 14 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSNetworkingManager.m

@@ -1326,6 +1326,20 @@
     [self request:get andWithUrl:url and:parm success:success faliure:faliure];
 }
 
+/// 置是否允许连麦
+/// @param get get
+/// @param roomUid 房间id
+/// @param whetherMic 是否连麦 0:是 1否
+/// @param success 成功
+/// @param faliure 失败
++ (void)liveRoomSetMicApplyEnable:(NSString *)get roomUid:(NSString *)roomUid whetherMic:(NSInteger)whetherMic success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure {
+    NSString *url = [NSString stringWithFormat:@"%@%@", hostURL, @"/api-teacher/liveRoom/whetherMic"];
+    NSMutableDictionary *parm = [NSMutableDictionary dictionary];
+    [parm setValue:roomUid forKey:@"roomUid"];
+    [parm setValue:@(whetherMic) forKey:@"whetherMic"];
+    [self request:get andWithUrl:url and:parm success:success faliure:faliure];
+}
+
 // 进入直播房间
 // /api-teacher/liveRoom/speakerJoinRoom
 

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Chat/View/ContractListCell.m

@@ -27,7 +27,7 @@
 - (void)configWithSource:(id)sourceModel {
     if ([sourceModel isKindOfClass:[FriendListModel class]]) {
         FriendListModel *model = sourceModel;
-        [self.friendAvatar sd_setImageWithURL:[NSURL URLWithString:model.friendAvatar] placeholderImage:[UIImage imageNamed:CHAT_USER_DEFAULT_LOGO]];
+        [self.friendAvatar sd_setImageWithURL:[NSURL URLWithString:[model.friendAvatar getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:CHAT_USER_DEFAULT_LOGO]];
         if ([NSString isEmptyString:model.friendNickname]) {
             self.friendName.text = [NSString stringWithFormat:@"游客%@",model.friendId];
         }

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Home/ReceiveEvaluate/View/ReceiveEvaluateCell.m

@@ -34,7 +34,7 @@
 }
 
 - (void)configWithSource:(ReceiveListModel *)model {
-    [self.userAvatal sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageNamed:USERDEFAULT_LOGO]];
+    [self.userAvatal sd_setImageWithURL:[NSURL URLWithString:[model.avatar getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:USERDEFAULT_LOGO]];
     if ([NSString isEmptyString:model.userName]) {
         self.studentName.text = [NSString stringWithFormat:@"游客%@",model.userId];
     }

+ 0 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Home/View/HomeBannerCell.m

@@ -26,7 +26,6 @@
         [self.bannerImage setImage:[UIImage imageNamed:@"video_placeholder"]];
     }
     else {
-        url = [url getUrlEndcodeString];
         [self.bannerImage sd_setImageWithURL:[NSURL URLWithString:[url getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:@"video_placeholder"]];
     }
 }

+ 39 - 21
KulexiuForTeacher/KulexiuForTeacher/Module/Live/Controller/LiveRoomViewController.m

@@ -411,17 +411,9 @@ typedef NS_ENUM(NSInteger, LIVEPAGE) {
     self.likeCount = [source integerValueForKey:@"likeNum"]; // 点赞数
     NSInteger lookCount = [source integerValueForKey:@"lookNum"];
     self.totalCount = lookCount; // 观看人数
-    NSString *roomConfig = [source stringValueForKey:@"roomConfig"];
-    NSData *jsonData = [roomConfig dataUsingEncoding:NSUTF8StringEncoding];
-    NSError *err;
-    NSDictionary *configDic = [NSJSONSerialization JSONObjectWithData:jsonData
-                                                              options:NSJSONReadingMutableContainers
-                                                                error:&err];
-    if (configDic) {
-        self.enableChat = ![configDic boolValueForKey:@"whether_chat"];
-        self.enableSeat = ![configDic boolValueForKey:@"whether_mic"];
-        self.enableLike = ![configDic boolValueForKey:@"whether_like"];
-    }
+    
+    self.enableSeat = ![source boolValueForKey:@"whether_mic"];
+
     BOOL isTemp = [[source stringValueForKey:@"roomType"] isEqualToString:@"TEMP"];
     self.isTempRoom = isTemp;
     if (isTemp == NO) {
@@ -432,8 +424,6 @@ typedef NS_ENUM(NSInteger, LIVEPAGE) {
         self.liveEndTime = [source stringValueForKey:@"liveEndTime"];
         self.expiredCloseMinute = 0;
     }
-    
-    
 }
 
 - (void)createLivePageViewDisplay {
@@ -1846,6 +1836,7 @@ typedef NS_ENUM(NSInteger, LIVEPAGE) {
         [_seatActionView opreationCallback:^(LIVESECONTROL action, LiveSeatMember * _Nonnull member) {
             [weakSelf opreationSeatApplyAction:action member:member];
         }];
+        _seatActionView.isForbiddenApply = !self.enableSeat;
     }
     return _seatActionView;
 }
@@ -1854,18 +1845,12 @@ typedef NS_ENUM(NSInteger, LIVEPAGE) {
     switch (control) {
         case LIVESECONTROL_ALLOW: // 允许连麦
         {
-            RCChatroomSeatsControl *message = [[RCChatroomSeatsControl alloc] init];
-            message.userId = self.createrId;
-            message.userName = self.createrName;
-            message.seatBan = NO;
-            [self sendMessage:message displayMessage:NO callback:^(BOOL success) {
-                            
-            }];
+            [self sendMicStatusRequest:0];
         }
             break;
         case LIVESECONTROL_FORBIDDEN: // 禁止连麦
         {
-            [self forceSeatAction];
+            [self sendMicStatusRequest:1];
         }
             break;
         case LIVESECONTROL_APPROVE: // 上麦
@@ -1935,6 +1920,39 @@ typedef NS_ENUM(NSInteger, LIVEPAGE) {
     }
 }
 
+// 是否允许连麦 0:是 1否
+- (void)sendMicStatusRequest:(NSInteger)whetherMic {
+    [self showhud];
+    [KSNetworkingManager liveRoomSetMicApplyEnable:KS_GET roomUid:self.roomId whetherMic:whetherMic success:^(NSDictionary * _Nonnull dic) {
+        [self removehub];
+        if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
+            if (whetherMic == 0) {
+                self.seatActionView.isForbiddenApply = NO;
+                [self enableSeatAction];
+            }
+            else {
+                self.seatActionView.isForbiddenApply = YES;
+                [self forceSeatAction];
+            }
+        }
+        else {
+            [self MBPShow:MESSAGEKEY];
+        }
+    } faliure:^(NSError * _Nonnull error) {
+        [self removehub];
+    }];
+}
+
+- (void)enableSeatAction {
+    RCChatroomSeatsControl *message = [[RCChatroomSeatsControl alloc] init];
+    message.userId = self.createrId;
+    message.userName = self.createrName;
+    message.seatBan = NO;
+    [self sendMessage:message displayMessage:NO callback:^(BOOL success) {
+        
+    }];
+}
+
 // 禁止连麦
 - (void)forceSeatAction {
     RCChatroomSeatsControl *message = [[RCChatroomSeatsControl alloc] init];

+ 2 - 2
KulexiuForTeacher/KulexiuForTeacher/Module/Live/View/SeatListView/LiveApplyControlView.m

@@ -46,7 +46,7 @@
     
     if (self.isForbiddenApply) {
         self.callback(APPLYACTION_ALLOW);
-        self.isForbiddenApply = !self.isForbiddenApply;
+//        self.isForbiddenApply = !self.isForbiddenApply;
     }
     else {
         MJWeakSelf;
@@ -60,7 +60,7 @@
 
 - (void)forbiddenSeatApply {
     self.callback(APPLYACTION_FORBIDDEN);
-    self.isForbiddenApply = !self.isForbiddenApply;
+//    self.isForbiddenApply = !self.isForbiddenApply;
 }
 
 - (void)setIsForbiddenApply:(BOOL)isForbiddenApply {

+ 2 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Live/View/SeatListView/LiveSeatActionView.h

@@ -24,6 +24,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface LiveSeatActionView : UIView
 
+@property (nonatomic, assign) BOOL isForbiddenApply;
+
 - (void)refreshSeatApplyTable:(NSArray *)seatMemberArray;
 
 - (void)opreationCallback:(LiveSeatActionCallback)callback;

+ 9 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Live/View/SeatListView/LiveSeatActionView.m

@@ -106,6 +106,14 @@
     }
 }
 
+- (void)setIsForbiddenApply:(BOOL)isForbiddenApply {
+    _isForbiddenApply = isForbiddenApply;
+    id value = [self.listViewArray lastObject];
+    if ([value isKindOfClass:[SeatBodyView class]]) {
+        SeatBodyView *listView = (SeatBodyView *)value;
+        listView.isForbiddenApply = isForbiddenApply;
+    }
+}
 
 
 #pragma mark - JXPagerViewDelegate
@@ -144,6 +152,7 @@
     }else if (index == 1) {
         listView.selectIndex = 1;
         listView.memberArray = [self.applyArray mutableCopy];
+        listView.isForbiddenApply = self.isForbiddenApply;
     }
     [listView beginFirstRefresh];
     return listView;

+ 2 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Live/View/SeatListView/SeatBodyView.h

@@ -28,6 +28,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, assign) BOOL isHeaderRefreshed;   //默认为YES
 
+@property (nonatomic, assign) BOOL isForbiddenApply; // 是否禁止连麦
+
 - (void)beginFirstRefresh;
 
 @end

+ 18 - 8
KulexiuForTeacher/KulexiuForTeacher/Module/Live/View/SeatListView/SeatBodyView.m

@@ -24,8 +24,23 @@
 @end
 
 @implementation SeatBodyView
+- (LiveApplyControlView *)controlView {
+    if (!_controlView) {
+        CGFloat headerHeight = 55;
+        _controlView = [LiveApplyControlView shareInstance];
+        _controlView.frame = CGRectMake(0, 0, KPortraitWidth, headerHeight);
+        MJWeakSelf;
+        [_controlView controlSeatCallback:^(APPLYACTION action) {
+            [weakSelf seatControlAction:action];
+        }];
+    }
+    return _controlView;
+}
 
-
+- (void)setIsForbiddenApply:(BOOL)isForbiddenApply {
+    _isForbiddenApply = isForbiddenApply;
+    self.controlView.isForbiddenApply = isForbiddenApply;
+}
 - (void)operationMemberAction:(LiveSeatCallback)callback {
     if (callback) {
         self.callback = callback;
@@ -92,13 +107,8 @@
         }
     }
     else {
-        if (!_controlView) {
-            _controlView = [LiveApplyControlView shareInstance];
-            _controlView.frame = CGRectMake(0, 0, KPortraitWidth, headerHeight);
-            MJWeakSelf;
-            [_controlView controlSeatCallback:^(APPLYACTION action) {
-                [weakSelf seatControlAction:action];
-            }];
+        if (![self.subviews containsObject:self.controlView]) {
+            
             [self addSubview:_controlView];
         }
     }