Commit 268b74d69c31b0b70addaced52f989878e54bca6
1 parent
3f2b5bff
屏蔽用户所有视频下的评论
1级评论反复滑动后显示删除的问题 2级评论 回复toSid错误问题
Showing
5 changed files
with
109 additions
and
15 deletions
metaCode/Classes/Config/CNLiveConfigManager.swift
| @@ -107,4 +107,9 @@ extension Notification.Name { | @@ -107,4 +107,9 @@ extension Notification.Name { | ||
| 107 | //退出登录失败通知 | 107 | //退出登录失败通知 |
| 108 | public static let CNLiveLoginOutNotification = Notification.Name("CNLiveLoginOutNotification") | 108 | public static let CNLiveLoginOutNotification = Notification.Name("CNLiveLoginOutNotification") |
| 109 | } | 109 | } |
| 110 | + struct VodManage{ | ||
| 111 | + //点播页评论列表刷新通知 | ||
| 112 | + public static let CNLiveReportUserSuccessRefreshCommentListNotification = Notification.Name("CNLiveReportUserSuccessRefreshCommentListNotification") | ||
| 113 | + } | ||
| 114 | + | ||
| 110 | } | 115 | } |
metaCode/Classes/Main/HuBiLieHomePage/Controller/CNLiveTVPlayerViewController.swift
| @@ -302,10 +302,22 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa | @@ -302,10 +302,22 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa | ||
| 302 | name: UIScreen.capturedDidChangeNotification, | 302 | name: UIScreen.capturedDidChangeNotification, |
| 303 | object: nil | 303 | object: nil |
| 304 | ) | 304 | ) |
| 305 | + //登录成功通知 | ||
| 306 | + NotificationCenter.default.addObserver(self, selector: #selector(CNLiveReportUserRefreshCommentSuccessNotificationAction), name: Notification.Name.VodManage.CNLiveReportUserSuccessRefreshCommentListNotification, object: nil) | ||
| 305 | 307 | ||
| 306 | // 直接关闭手势识别 | 308 | // 直接关闭手势识别 |
| 307 | // self.navigationController?.interactivePopGestureRecognizer?.isEnabled = false | 309 | // self.navigationController?.interactivePopGestureRecognizer?.isEnabled = false |
| 308 | } | 310 | } |
| 311 | + | ||
| 312 | + @objc func CNLiveReportUserRefreshCommentSuccessNotificationAction() { | ||
| 313 | + //举报用户成功 刷新评论列表 | ||
| 314 | + if let commmentListView = self.bottomCommentShowContainView.viewWithTag(1000) as? CNLiveShortVideoCommentListView{ | ||
| 315 | + commmentListView.isReset = true | ||
| 316 | + commmentListView.pageNum = 0 | ||
| 317 | + commmentListView.requestDataSource() | ||
| 318 | + } | ||
| 319 | + } | ||
| 320 | + | ||
| 309 | 321 | ||
| 310 | @objc func appDidEnterBackground() { | 322 | @objc func appDidEnterBackground() { |
| 311 | self.pausePlayerIfNeed() | 323 | self.pausePlayerIfNeed() |
| @@ -894,7 +906,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa | @@ -894,7 +906,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa | ||
| 894 | self.controlView.controlXuanjiUpdateBlock = { [weak self] index,albumModel in | 906 | self.controlView.controlXuanjiUpdateBlock = { [weak self] index,albumModel in |
| 895 | guard let self = self else { return } | 907 | guard let self = self else { return } |
| 896 | let vodModel = albumModel | 908 | let vodModel = albumModel |
| 897 | - //点击横屏-专辑 剧集的某集按钮 | 909 | + //横屏-点击专辑 剧集的某集按钮 |
| 898 | var yuanString = "1" | 910 | var yuanString = "1" |
| 899 | let isPaid = CNLivePlayerTool.isPaid(product: vodModel.product) | 911 | let isPaid = CNLivePlayerTool.isPaid(product: vodModel.product) |
| 900 | if isPaid{ | 912 | if isPaid{ |
| @@ -1694,7 +1706,6 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa | @@ -1694,7 +1706,6 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa | ||
| 1694 | //未付费 | 1706 | //未付费 |
| 1695 | self.player.currentPlayerManager.pause() | 1707 | self.player.currentPlayerManager.pause() |
| 1696 | self.player.enterFullScreen(false, animated: false) | 1708 | self.player.enterFullScreen(false, animated: false) |
| 1697 | - //[self.player enterFullScreen:NO animated:YES]; | ||
| 1698 | 1709 | ||
| 1699 | self.currentPlayIsNeedPay = true | 1710 | self.currentPlayIsNeedPay = true |
| 1700 | if isAblumVideo{ | 1711 | if isAblumVideo{ |
| @@ -1716,6 +1727,11 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa | @@ -1716,6 +1727,11 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa | ||
| 1716 | 1727 | ||
| 1717 | //成功用pay参数 刷新页面 | 1728 | //成功用pay参数 刷新页面 |
| 1718 | self.setPayParams(payVodAlbumListModel: payVodAlbumListModel, payContentId: payVodAlbumListModel?.contentId ?? "", payAid: payVodAlbumListModel?.albumId ?? "", payAlbumListArr: albumListArray, payIndex: albumSelectIndex, payTitle: modelTitle, payIsAlbum: isAblumVideo, payActivityId: mdlActiveId, isPayZhuanJi: isPayZhuanJi, payVodProductModel: mdlProduct) | 1729 | self.setPayParams(payVodAlbumListModel: payVodAlbumListModel, payContentId: payVodAlbumListModel?.contentId ?? "", payAid: payVodAlbumListModel?.albumId ?? "", payAlbumListArr: albumListArray, payIndex: albumSelectIndex, payTitle: modelTitle, payIsAlbum: isAblumVideo, payActivityId: mdlActiveId, isPayZhuanJi: isPayZhuanJi, payVodProductModel: mdlProduct) |
| 1730 | + | ||
| 1731 | +// self.player.allowOrentitaionRotation = true//test | ||
| 1732 | +// self.resetPayParams()//test | ||
| 1733 | +// self.controlView.payBgView.isHidden = true | ||
| 1734 | + | ||
| 1719 | // //成功用pay参数 刷新页面 | 1735 | // //成功用pay参数 刷新页面 |
| 1720 | // self.payVodAlbumListModel = payVodAlbumListModel | 1736 | // self.payVodAlbumListModel = payVodAlbumListModel |
| 1721 | // self.payAid = payVodAlbumListModel?.albumId ?? "" | 1737 | // self.payAid = payVodAlbumListModel?.albumId ?? "" |
metaCode/Classes/Main/HuBiLieHomePage/View/VodDetail/HengPing/CNLiveVodLandscapeXuanjiView.swift
| @@ -242,6 +242,7 @@ class CNLiveVodLandscapeXuanjiView:UIView, UITableViewDataSource, UITableViewDel | @@ -242,6 +242,7 @@ class CNLiveVodLandscapeXuanjiView:UIView, UITableViewDataSource, UITableViewDel | ||
| 242 | if imgBottom > maxContentHeight{ | 242 | if imgBottom > maxContentHeight{ |
| 243 | maxContentHeight = imgBottom | 243 | maxContentHeight = imgBottom |
| 244 | } | 244 | } |
| 245 | + print("1111bgScrollView:containerWidth\(containerWidth),maxContentHeight\(maxContentHeight)") | ||
| 245 | self.bgScrollView.contentSize = CGSize(width: containerWidth, height: maxContentHeight) | 246 | self.bgScrollView.contentSize = CGSize(width: containerWidth, height: maxContentHeight) |
| 246 | let expandBtn = UIButton.init(type: .custom) | 247 | let expandBtn = UIButton.init(type: .custom) |
| 247 | expandBtn.frame = CGRect(x: imgX, y: imgY, width: WH, height: WH) | 248 | expandBtn.frame = CGRect(x: imgX, y: imgY, width: WH, height: WH) |
metaCode/Classes/Main/VideoPage/View/CNLiveShortVideoCommentListView.swift
| @@ -278,7 +278,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | @@ -278,7 +278,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | ||
| 278 | let commentView = CNLiveShortVideoCommentListView.init(frame: CGRect.zero, pid: pid, toSid: contentSid) | 278 | let commentView = CNLiveShortVideoCommentListView.init(frame: CGRect.zero, pid: pid, toSid: contentSid) |
| 279 | commentView.resultBlock = result | 279 | commentView.resultBlock = result |
| 280 | commentView.closeBlock = close | 280 | commentView.closeBlock = close |
| 281 | - | 281 | + commentView.tag = 1000 |
| 282 | containView.addSubview(commentView) | 282 | containView.addSubview(commentView) |
| 283 | commentView.snp.makeConstraints { make in | 283 | commentView.snp.makeConstraints { make in |
| 284 | make.edges.equalToSuperview() | 284 | make.edges.equalToSuperview() |
| @@ -612,7 +612,12 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | @@ -612,7 +612,12 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | ||
| 612 | replyUnfoldButton.isHidden = true | 612 | replyUnfoldButton.isHidden = true |
| 613 | } | 613 | } |
| 614 | replyButton.setTitle("回复", for: .normal) | 614 | replyButton.setTitle("回复", for: .normal) |
| 615 | - if ((contentSid == UserInfoManager.shared.userInfo.uid) || (commentData.uid == UserInfoManager.shared.userInfo.uid)) { | 615 | + let contSid = contentSid |
| 616 | + let uid = UserInfoManager.shared.userInfo.uid | ||
| 617 | + let commentDataUid = commentData.uid | ||
| 618 | +// print("111111contSid:\(contSid),uid:\(uid),commentDataUid:\(commentDataUid),content:\(commentData.content)") | ||
| 619 | +// if ((contentSid == UserInfoManager.shared.userInfo.uid) || (commentData.uid == UserInfoManager.shared.userInfo.uid)) { | ||
| 620 | + if ((commentData.uid == UserInfoManager.shared.userInfo.uid)) { | ||
| 616 | deleteButton.isHidden = false | 621 | deleteButton.isHidden = false |
| 617 | } else { | 622 | } else { |
| 618 | deleteButton.isHidden = true | 623 | deleteButton.isHidden = true |
| @@ -661,7 +666,8 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | @@ -661,7 +666,8 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | ||
| 661 | let contentSidStr = contentSid | 666 | let contentSidStr = contentSid |
| 662 | let uidStr = UserInfoManager.shared.userInfo.uid | 667 | let uidStr = UserInfoManager.shared.userInfo.uid |
| 663 | let replyFromSidStr = replyItemModel.fromSid | 668 | let replyFromSidStr = replyItemModel.fromSid |
| 664 | - if ((contentSid == UserInfoManager.shared.userInfo.uid) || (replyItemModel.fromSid == UserInfoManager.shared.userInfo.uid)) { | 669 | +// if ((contentSid == UserInfoManager.shared.userInfo.uid) || (replyItemModel.fromSid == UserInfoManager.shared.userInfo.uid)) { |
| 670 | + if ( (replyItemModel.fromSid == UserInfoManager.shared.userInfo.uid)) { | ||
| 665 | replyButton.setTitle("删除", for: .normal) | 671 | replyButton.setTitle("删除", for: .normal) |
| 666 | } else { | 672 | } else { |
| 667 | replyButton.setTitle("回复", for: .normal) | 673 | replyButton.setTitle("回复", for: .normal) |
| @@ -687,24 +693,28 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | @@ -687,24 +693,28 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | ||
| 687 | 693 | ||
| 688 | @objc func replyMethod(button: UIButton) { | 694 | @objc func replyMethod(button: UIButton) { |
| 689 | if button.titleLabel?.text == "回复" { | 695 | if button.titleLabel?.text == "回复" { |
| 690 | - let uid = commentModel == nil ? replyItemModel.fromSid : commentModel.uid | ||
| 691 | - CNLiveContentToolTextView.showCommentViewForCustom(withCommType: .reply, fromNick: commentModel == nil ? replyItemModel.fromNick : commentModel.nick, firstRespFace: false, successBlcok: {[weak self] commentString, toolbarView in | 696 | + let currUid = self.currentIsComment ? commentModel.uid : replyItemModel.replyId |
| 697 | + let fromNick = self.currentIsComment ? commentModel.nick : replyItemModel.fromNick | ||
| 698 | + let toSid = self.currentIsComment ? (commentModel.uid ?? "") : (replyItemModel.fromSid ?? "") | ||
| 699 | + CNLiveContentToolTextView.showCommentViewForCustom(withCommType: .reply, fromNick: fromNick, firstRespFace: false, successBlcok: {[weak self] commentString, toolbarView in | ||
| 692 | guard let self = self else { return } | 700 | guard let self = self else { return } |
| 693 | - CNLiveShortVideoViewModel.requestCommentWithReply(commentId: self.commentModel.commentId!, comment: commentString ?? "", toSid: self.commentModel.uid!, fromSid: UserInfoManager.shared.userInfo.uid, level: "1") {[weak self] result, respStatue in | 701 | + CNLiveShortVideoViewModel.requestCommentWithReply(commentId: self.commentModel.commentId!, comment: commentString ?? "", toSid: toSid, fromSid: UserInfoManager.shared.userInfo.uid, level: "1") {[weak self] result, respStatue in |
| 694 | guard let self = self else { return } | 702 | guard let self = self else { return } |
| 695 | if respStatue == .success { | 703 | if respStatue == .success { |
| 696 | showMessage(message: result as! String) | 704 | showMessage(message: result as! String) |
| 697 | if self.replyItemModel != nil { | 705 | if self.replyItemModel != nil { |
| 698 | - self.reloadItemBlock(self.commentModel == nil ? replyItemModel! : commentModel!) | 706 | + self.reloadItemBlock(!self.currentIsComment ? replyItemModel! : commentModel!) |
| 707 | +// self.reloadItemBlock(self.commentModel == nil ? replyItemModel! : commentModel!) | ||
| 699 | } else { | 708 | } else { |
| 700 | - self.reloadBlcok(self.commentModel == nil ? replyItemModel! : commentModel!) | 709 | + self.reloadBlcok(!self.currentIsComment ? replyItemModel! : commentModel!) |
| 710 | +// self.reloadBlcok(self.commentModel == nil ? replyItemModel! : commentModel!) | ||
| 701 | } | 711 | } |
| 702 | } | 712 | } |
| 703 | } | 713 | } |
| 704 | }, dissBlock: { toolbarView in}) | 714 | }, dissBlock: { toolbarView in}) |
| 705 | } else { | 715 | } else { |
| 706 | 716 | ||
| 707 | - AlertTool.systemAlert(title: "确认删除该条\(commentModel != nil ? "评论" : "回复")吗?", message: "", cancelTitle: "取消", confirmTitle: "确定") {[weak self] index in | 717 | + AlertTool.systemAlert(title: "确认删除该条\(self.currentIsComment ? "评论" : "回复")吗?", message: "", cancelTitle: "取消", confirmTitle: "确定") {[weak self] index in |
| 708 | guard let self = self else { return } | 718 | guard let self = self else { return } |
| 709 | if index == 1 { | 719 | if index == 1 { |
| 710 | if replyItemModel != nil { | 720 | if replyItemModel != nil { |
| @@ -749,8 +759,9 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | @@ -749,8 +759,9 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | ||
| 749 | currVideoId = commentModel.topicId | 759 | currVideoId = commentModel.topicId |
| 750 | level = "2" | 760 | level = "2" |
| 751 | } | 761 | } |
| 762 | + | ||
| 752 | if currFromSid == uid{// || contentSid == UserInfoManager.shared.userInfo.uid { | 763 | if currFromSid == uid{// || contentSid == UserInfoManager.shared.userInfo.uid { |
| 753 | - AlertTool.systemActionSheet(title: "请选择", message: "", actionTitles: ["删除该条评论","举报"], cancelTitle: "取消") {[weak self] index in | 764 | + AlertTool.systemActionSheet(title: "请选择", message: "", actionTitles: ["删除该条评论","举报这条评论"], cancelTitle: "取消") {[weak self] index in |
| 754 | guard let self = self else { return } | 765 | guard let self = self else { return } |
| 755 | if index == 1 { | 766 | if index == 1 { |
| 756 | //"删除该条评论" | 767 | //"删除该条评论" |
| @@ -789,7 +800,7 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | @@ -789,7 +800,7 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | ||
| 789 | // } | 800 | // } |
| 790 | }else{ | 801 | }else{ |
| 791 | //不是本人 | 802 | //不是本人 |
| 792 | - AlertTool.systemActionSheet(title: "请选择", message: "", actionTitles: ["举报"], cancelTitle: "取消") {[weak self] index in | 803 | + AlertTool.systemActionSheet(title: "请选择", message: "", actionTitles: ["举报这条评论","屏蔽该用户"], cancelTitle: "取消") {[weak self] index in |
| 793 | guard let self = self else { return } | 804 | guard let self = self else { return } |
| 794 | if index == 1 { | 805 | if index == 1 { |
| 795 | //"举报" | 806 | //"举报" |
| @@ -806,8 +817,23 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | @@ -806,8 +817,23 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | ||
| 806 | 817 | ||
| 807 | } | 818 | } |
| 808 | } | 819 | } |
| 809 | - | ||
| 810 | -// currentViewController()?.navigationController?.pushViewController(CNLiveInputFeedBackViewController.init(show_type: .problem), animated: true) | 820 | + }else if index == 2 { |
| 821 | + //"屏蔽用户所有评论" | ||
| 822 | + CNLiveShortVideoViewModel.reportUserAllComment(reportSid: currFromSid!, type: "我不喜欢") {[weak self] result, respStatue in | ||
| 823 | + guard let self = self else { return } | ||
| 824 | + if respStatue == .success{ | ||
| 825 | + showMessage(message: "提交成功,已为您屏蔽该用户所有的评论") | ||
| 826 | + //刷新评论列表 | ||
| 827 | + //发通知 | ||
| 828 | + NotificationCenter.default.post(name: Notification.Name.VodManage.CNLiveReportUserSuccessRefreshCommentListNotification, object: nil) | ||
| 829 | +// if self.currentIsComment{ | ||
| 830 | +// self.deleteBlock(self.commentModel!) | ||
| 831 | +// }else{ | ||
| 832 | +// self.deleteItemBlock(self.replyItemModel!) | ||
| 833 | +// } | ||
| 834 | + | ||
| 835 | + } | ||
| 836 | + } | ||
| 811 | } | 837 | } |
| 812 | } | 838 | } |
| 813 | } | 839 | } |
metaCode/Classes/Main/VideoPage/ViewModel/CNLiveShortVideoViewModel.swift
| @@ -704,4 +704,50 @@ class CNLiveShortVideoViewModel: NSObject { | @@ -704,4 +704,50 @@ class CNLiveShortVideoViewModel: NSObject { | ||
| 704 | } | 704 | } |
| 705 | } | 705 | } |
| 706 | 706 | ||
| 707 | + /// 屏蔽用户所有视频下的评论 | ||
| 708 | + /// - Parameters: | ||
| 709 | + /// - videoId: 视频 id | ||
| 710 | + /// - commentId: 评论 id | ||
| 711 | + /// - type 举报类型 | ||
| 712 | + /// - level 1评论 2回复 | ||
| 713 | + /// - reultShortVideoBlock: 返回 | ||
| 714 | + static func reportUserAllComment(reportSid:String, type:String, reultShortVideoBlock: @escaping resultShortVideoBlock) { | ||
| 715 | + let param = NSMutableDictionary() | ||
| 716 | + param.setValue(CNLiveMCEnvironmentManager.shared.appId, forKey: "appId") | ||
| 717 | + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | ||
| 718 | + param.setValue(reportSid, forKey: "reportSid") | ||
| 719 | + param.setValue("i", forKey: "plat") | ||
| 720 | + param.setValue(type, forKey: "type") | ||
| 721 | + | ||
| 722 | + let signStr = CNLiveBusinessTools.signvalue(param as! [AnyHashable : Any]) | ||
| 723 | + let string1 = "\(signStr)&key=\(CNLiveMCEnvironmentManager.shared.appKey)" | ||
| 724 | + let signString1 = CNLiveBusinessTools.sha1(string1).uppercased() | ||
| 725 | + param.setValue(signString1, forKey: "sign") | ||
| 726 | + | ||
| 727 | + CNLiveNetworking.setAllowRequestDefaultArgument(false) | ||
| 728 | + CNLiveNetworking.setupShowDataResult(false) | ||
| 729 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseTokenUrl+"/commentServices/commentForUgc/reportUser", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | ||
| 730 | + hiddenLoading()//https://api.cnlive.com/open/api2/commentServices/commentForUgc/reportUser | ||
| 731 | + if (error == nil) { | ||
| 732 | + let resp = result as! NSDictionary | ||
| 733 | + let errorCode = "\(resp["errorCode"] ?? "0")" | ||
| 734 | + if (errorCode == "0") { | ||
| 735 | + reultShortVideoBlock("成功", .success) | ||
| 736 | + } else { | ||
| 737 | +// showMessage(message: resp["errorMessage"] as! String) | ||
| 738 | + reultShortVideoBlock(NSNull(),.failed) | ||
| 739 | + } | ||
| 740 | + } else { | ||
| 741 | + if CNLiveNetworking.isNetworking() { | ||
| 742 | + showMessage(message: "请求失败") | ||
| 743 | + reultShortVideoBlock(NSNull(),.failed) | ||
| 744 | + } else { | ||
| 745 | + showMessage(message: "似乎与网络断开链接") | ||
| 746 | + reultShortVideoBlock(NSNull(),.noNetwork) | ||
| 747 | + } | ||
| 748 | + } | ||
| 749 | + } | ||
| 750 | + } | ||
| 751 | + | ||
| 752 | + | ||
| 707 | } | 753 | } |