Commit 0daa2ef3a87b64581cc1cd1f79f916c4fae16594
1 parent
dfcd45e0
游客模式增加内购时 uuid登录
横屏看点时点击付费转竖屏 评论举报
Showing
7 changed files
with
186 additions
and
9 deletions
metaCode.xcodeproj/project.pbxproj
| ... | ... | @@ -2972,7 +2972,7 @@ |
| 2972 | 2972 | CODE_SIGN_ENTITLEMENTS = metaCode/metaCode.entitlements; |
| 2973 | 2973 | CODE_SIGN_IDENTITY = "Apple Development"; |
| 2974 | 2974 | CODE_SIGN_STYLE = Automatic; |
| 2975 | - CURRENT_PROJECT_VERSION = 1.1.8.25.04.28.22; | |
| 2975 | + CURRENT_PROJECT_VERSION = 1.1.8.25.04.29.22; | |
| 2976 | 2976 | DEBUG_INFORMATION_FORMAT = dwarf; |
| 2977 | 2977 | DEVELOPMENT_TEAM = 94X49GG3ZW; |
| 2978 | 2978 | ENABLE_BITCODE = NO; |
| ... | ... | @@ -3228,7 +3228,7 @@ |
| 3228 | 3228 | CODE_SIGN_ENTITLEMENTS = metaCode/metaCode.entitlements; |
| 3229 | 3229 | CODE_SIGN_IDENTITY = "Apple Development"; |
| 3230 | 3230 | CODE_SIGN_STYLE = Automatic; |
| 3231 | - CURRENT_PROJECT_VERSION = 1.1.8.25.04.28.22; | |
| 3231 | + CURRENT_PROJECT_VERSION = 1.1.8.25.04.29.22; | |
| 3232 | 3232 | DEVELOPMENT_TEAM = 94X49GG3ZW; |
| 3233 | 3233 | ENABLE_BITCODE = NO; |
| 3234 | 3234 | ENABLE_MODULE_VERIFIER = NO; | ... | ... |
metaCode/Classes/Main/HuBiLieHomePage/Controller/CNLiveTVPlayerViewController.swift
| ... | ... | @@ -622,7 +622,22 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 622 | 622 | } |
| 623 | 623 | self.isPlayAblumOrKandian = false |
| 624 | 624 | self.kanDianIndex = seleIndex |
| 625 | - self.kanDianOrAlbumChangeContentApi(contentId: vodPlayBlockListListModel.contentId, title: vodPlayBlockListListModel.title, isAlbum: isAblumVideo, activeId: vodPlayBlockListListModel.pid, isRefreshPlayer:true ) | |
| 625 | + self.albumIndex = -1 | |
| 626 | +// self.kanDianOrAlbumChangeContentApi(contentId: vodPlayBlockListListModel.contentId, title: vodPlayBlockListListModel.title, isAlbum: isAblumVideo, activeId: vodPlayBlockListListModel.pid, isRefreshPlayer:true ) | |
| 627 | + | |
| 628 | + let isPaid = CNLivePlayerTool.isPaid(product: vodPlayBlockListListModel.product) | |
| 629 | + isPayZhuanJi = !isPaid | |
| 630 | + | |
| 631 | + var yuanString = "1" | |
| 632 | + let fenString = vodPlayBlockListListModel.product?.iosRmb ?? "100" | |
| 633 | + // 将字符串转换为整数 | |
| 634 | + let fen = Int(fenString) ?? 100 | |
| 635 | + // 计算元值(整数除法,自动舍去小数部分) | |
| 636 | + var yuan = fen / 100 | |
| 637 | + // 将结果转换为字符串 | |
| 638 | + yuanString = String(yuan) | |
| 639 | + self.selectKanDianOrAlbum(isPayZhuanJi: isPayZhuanJi, mdlProduct: vodPlayBlockListListModel.product, mdlContentId: vodPlayBlockListListModel.contentId, isAblumVideo: false, albumSelectIndex: self.albumIndex, albumListArray: NSMutableArray(), kanDianSelectIndex: self.kanDianIndex, kanDianListArray: self.kanDianListArr, isPlayAblumOrKandian: false, xuanjiBgViewCurrSeleIdx: self.kanDianIndex, xuanjiBgViewKanDianListArr: self.kanDianListArr, modelTitle: vodPlayBlockListListModel.title, mdlActiveId: vodPlayBlockListListModel.pid, mdlModel: vodPlayBlockListListModel.model, yuanString: yuanString, payVodAlbumListModel: nil, vodAlbumListBaseModel: nil) | |
| 640 | + | |
| 626 | 641 | |
| 627 | 642 | } |
| 628 | 643 | |
| ... | ... | @@ -1639,6 +1654,10 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 1639 | 1654 | } |
| 1640 | 1655 | }else{ |
| 1641 | 1656 | //未付费 |
| 1657 | + self.player.currentPlayerManager.pause() | |
| 1658 | + self.player.enterFullScreen(false, animated: false) | |
| 1659 | + //[self.player enterFullScreen:NO animated:YES]; | |
| 1660 | + | |
| 1642 | 1661 | self.currentPlayIsNeedPay = true |
| 1643 | 1662 | if isAblumVideo{ |
| 1644 | 1663 | //点击专辑 |
| ... | ... | @@ -1682,7 +1701,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa |
| 1682 | 1701 | vodMdl.model = mdlModel |
| 1683 | 1702 | self.controlView.vodPlayModel = vodMdl |
| 1684 | 1703 | self.controlView.payBgView.isHidden = false |
| 1685 | - self.controlView.payBgView.payBtn.setTitle("\(yuanString)元购买本集内容", for: .normal) | |
| 1704 | + self.controlView.payBgView.payBtn.setTitle("\(yuanString)元购买本内容", for: .normal) | |
| 1686 | 1705 | |
| 1687 | 1706 | self.contentId = mdlContentId |
| 1688 | 1707 | self.albumIndex = albumSelectIndex | ... | ... |
metaCode/Classes/Main/HuBiLieHomePage/View/VodDetail/HengPing/CNLiveVodPayView.swift
| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | // 支付页面 |
| 7 | 7 | |
| 8 | 8 | import Foundation |
| 9 | +import CNLiveBusinessTools | |
| 9 | 10 | |
| 10 | 11 | typealias CNLiveVodPayViewPayBlock = ()->Void |
| 11 | 12 | |
| ... | ... | @@ -108,7 +109,30 @@ class CNLiveVodPayView:UIView,UIGestureRecognizerDelegate{ |
| 108 | 109 | if metaAppDelegate.isLogin{ |
| 109 | 110 | self.payBlock?() |
| 110 | 111 | }else{ |
| 111 | - metaAppDelegate.pushLoginVC() | |
| 112 | + //游客模式未登录 提示登录 | |
| 113 | + AlertTool.showSystemAlert(title: "是否登录?", message: "登录后能通过其他设备访问已付费内容", actionTitles: ["确定","取消"], style: .alert) { index in | |
| 114 | + if index == 1 { | |
| 115 | + //确定 //是->跳登录 | |
| 116 | + metaAppDelegate.pushLoginVC() | |
| 117 | + }else if index == 2 { | |
| 118 | + //取消 | |
| 119 | + //否->uuid内购购买 | |
| 120 | + showLoading(message: "") | |
| 121 | + let uuid = CNLiveBusinessTools.uuid() | |
| 122 | + print("uuid:\(uuid)") | |
| 123 | + CNLiveLoginViewModel.requestUUIDLoginInDevice(uuid: uuid, frmld: "") { result, status in | |
| 124 | + if status == .success{ | |
| 125 | + let uid = UserInfoManager.shared.userInfo.uid | |
| 126 | + self.payBlock?() | |
| 127 | + } | |
| 128 | + } | |
| 129 | + } | |
| 130 | + } | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 112 | 136 | } |
| 113 | 137 | } |
| 114 | 138 | ... | ... |
metaCode/Classes/Main/LoginPage/ViewModel/CNLiveLoginViewModel.swift
| ... | ... | @@ -314,4 +314,45 @@ class CNLiveLoginViewModel : NSObject { |
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | } |
| 317 | + | |
| 318 | + | |
| 319 | + /// UUID LoginInDevice | |
| 320 | + static func requestUUIDLoginInDevice(uuid: String ,frmld:String, resultBlock: @escaping downSlideResultBlock) { | |
| 321 | + let param = NSMutableDictionary.init() | |
| 322 | + param.setValue(uuid, forKey: "uuid") | |
| 323 | + param.setValue(frmld, forKey: "frmld") | |
| 324 | + param.setValue("i", forKey: "clientPlat") | |
| 325 | + showLoading(message: "") | |
| 326 | + let custom_param = NSMutableDictionary() | |
| 327 | + custom_param.setValue(CNLiveMCEnvironmentManager.shared.appId, forKey: "appId") | |
| 328 | + custom_param.setValue(CNLiveMCEnvironmentManager.shared.appKey, forKey: "appKey") | |
| 329 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | |
| 330 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | |
| 331 | + CNLiveNetworking.setupShowDataResult(false) | |
| 332 | + CNLiveNetworking.setupShowResult(true) | |
| 333 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPLoginHost+"/open/api2/user/loginInDevice", param: param as! [String : Any], cacheType: .networkOnly) { task, result, error in | |
| 334 | + hiddenLoading() | |
| 335 | + if (error == nil) { | |
| 336 | + let resp = result as! NSDictionary | |
| 337 | + let errorCode = resp["errorCode"] | |
| 338 | + if (errorCode as! String == "0") { | |
| 339 | + if resp.allKeys.contains(where: { item in | |
| 340 | + return item as! String == "data" | |
| 341 | + }) { | |
| 342 | + let userInfoModel = dictionaryToModel(resp as! [String : Any], UserInfoModel.self,"data") | |
| 343 | + UserInfoManager.cacheUserInfo(userInfo: userInfoModel as! UserInfoModel) | |
| 344 | + UserDefaults.standard.set(false,forKey: "is_login") | |
| 345 | + RangersAPM.setUserID(UserInfoManager.shared.userInfo.uid) | |
| 346 | + resultBlock(userInfoModel, .success) | |
| 347 | + } | |
| 348 | + } else { | |
| 349 | +// showMessage(message: resp["errorMessage"] as! String) | |
| 350 | + resultBlock(NSNull(), .failed) | |
| 351 | + } | |
| 352 | + } else { | |
| 353 | + resultBlock(NSNull(), .failed) | |
| 354 | + } | |
| 355 | + } | |
| 356 | + } | |
| 357 | + | |
| 317 | 358 | } | ... | ... |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
metaCode/Classes/Main/VideoPage/View/CNLiveShortVideoCommentListView.swift
| ... | ... | @@ -735,10 +735,19 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel |
| 735 | 735 | let uid = UserInfoManager.shared.userInfo.uid |
| 736 | 736 | // let contentsid = contentSid |
| 737 | 737 | var currFromSid:String? |
| 738 | + var currCommentId:String? | |
| 739 | + var currVideoId:String? | |
| 740 | + var level:String? | |
| 738 | 741 | if self.currentIsComment{ |
| 739 | 742 | currFromSid = commentModel.uid |
| 743 | + currCommentId = commentModel.commentId | |
| 744 | + currVideoId = commentModel.topicId | |
| 745 | + level = "1" | |
| 740 | 746 | }else{ |
| 741 | 747 | currFromSid = replyItemModel.fromSid |
| 748 | + currCommentId = replyItemModel.replyId | |
| 749 | + currVideoId = commentModel.topicId | |
| 750 | + level = "2" | |
| 742 | 751 | } |
| 743 | 752 | if currFromSid == uid{// || contentSid == UserInfoManager.shared.userInfo.uid { |
| 744 | 753 | AlertTool.systemActionSheet(title: "请选择", message: "", actionTitles: ["删除该条评论","举报"], cancelTitle: "取消") {[weak self] index in |
| ... | ... | @@ -746,14 +755,25 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel |
| 746 | 755 | if index == 1 { |
| 747 | 756 | //"删除该条评论" |
| 748 | 757 | showLoading(message: "") |
| 749 | - CNLiveShortVideoViewModel.requestCommentDelete(videoId: self.videoId, commentId: self.commentModel.commentId!) {result, respStatue in | |
| 758 | + CNLiveShortVideoViewModel.requestCommentDelete(videoId: currVideoId!, commentId: currCommentId!) {result, respStatue in | |
| 750 | 759 | if respStatue == .success { |
| 751 | 760 | self.deleteBlock(self.commentModel!) |
| 752 | 761 | } |
| 753 | 762 | } |
| 754 | 763 | }else if index == 2 { |
| 755 | 764 | //"举报" |
| 756 | - currentViewController()?.navigationController?.pushViewController(CNLiveInputFeedBackViewController.init(show_type: .problem), animated: true) | |
| 765 | + CNLiveShortVideoViewModel.reportComment(level: level!, videoId: currVideoId!, commentId: currCommentId!, reportsid: currFromSid!, type: "我不喜欢") { result, respStatue in | |
| 766 | + if respStatue == .success{ | |
| 767 | + showMessage(message: "提交成功,已为您隐藏该评论") | |
| 768 | + //刷新评论列表 | |
| 769 | + if self.currentIsComment{ | |
| 770 | + self.deleteBlock(self.commentModel!) | |
| 771 | + }else{ | |
| 772 | + self.deleteItemBlock(self.replyItemModel!) | |
| 773 | + } | |
| 774 | + } | |
| 775 | + } | |
| 776 | + | |
| 757 | 777 | } |
| 758 | 778 | } |
| 759 | 779 | // AlertTool.systemAlert(title: "确认删除该条评论吗?", message: "", cancelTitle: "取消", confirmTitle: "确定") {[weak self] index in |
| ... | ... | @@ -773,7 +793,21 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel |
| 773 | 793 | guard let self = self else { return } |
| 774 | 794 | if index == 1 { |
| 775 | 795 | //"举报" |
| 776 | - currentViewController()?.navigationController?.pushViewController(CNLiveInputFeedBackViewController.init(show_type: .problem), animated: true) | |
| 796 | + CNLiveShortVideoViewModel.reportComment(level: level!, videoId: currVideoId!, commentId: currCommentId!, reportsid: currFromSid!, type: "我不喜欢") {[weak self] result, respStatue in | |
| 797 | + guard let self = self else { return } | |
| 798 | + if respStatue == .success{ | |
| 799 | + showMessage(message: "提交成功,已为您隐藏该评论") | |
| 800 | + //刷新评论列表 | |
| 801 | + if self.currentIsComment{ | |
| 802 | + self.deleteBlock(self.commentModel!) | |
| 803 | + }else{ | |
| 804 | + self.deleteItemBlock(self.replyItemModel!) | |
| 805 | + } | |
| 806 | + | |
| 807 | + } | |
| 808 | + } | |
| 809 | + | |
| 810 | +// currentViewController()?.navigationController?.pushViewController(CNLiveInputFeedBackViewController.init(show_type: .problem), animated: true) | |
| 777 | 811 | } |
| 778 | 812 | } |
| 779 | 813 | } | ... | ... |
metaCode/Classes/Main/VideoPage/ViewModel/CNLiveShortVideoViewModel.swift
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | import Foundation |
| 9 | 9 | import CNLiveRequestBastKit |
| 10 | 10 | import QMUIKit |
| 11 | +import CNLiveBusinessTools | |
| 11 | 12 | typealias resultShortVideoBlock = (_ result: Any,_ respStatue :CNLiveMineResponseType) -> Void |
| 12 | 13 | class CNLiveShortVideoViewModel: NSObject { |
| 13 | 14 | |
| ... | ... | @@ -645,4 +646,62 @@ class CNLiveShortVideoViewModel: NSObject { |
| 645 | 646 | } |
| 646 | 647 | } |
| 647 | 648 | |
| 649 | + /// 举报评论 | |
| 650 | + /// - Parameters: | |
| 651 | + /// - videoId: 视频 id | |
| 652 | + /// - commentId: 评论 id | |
| 653 | + /// - type 举报类型 | |
| 654 | + /// - level 1评论 2回复 | |
| 655 | + /// - reultShortVideoBlock: 返回 | |
| 656 | + static func reportComment(level: String,videoId: String, commentId: String, reportsid:String, type:String, reultShortVideoBlock: @escaping resultShortVideoBlock) { | |
| 657 | + let param = NSMutableDictionary() | |
| 658 | + param.setValue(reportsid, forKey: "reportSid") | |
| 659 | + param.setValue(commentId, forKey: "commentId") | |
| 660 | + param.setValue(type, forKey: "type") | |
| 661 | + param.setValue(level, forKey: "level") | |
| 662 | + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | |
| 663 | + param.setValue("i", forKey: "plat") | |
| 664 | + param.setValue(CNLiveMCEnvironmentManager.shared.appId, forKey: "appId") | |
| 665 | +// param.setValue("mc_\(videoId)", forKey: "topicId") | |
| 666 | + let isContainMC = videoId.contains("mc_") | |
| 667 | + if isContainMC{ | |
| 668 | + param.setValue("\(videoId)", forKey: "topicId") | |
| 669 | + }else{ | |
| 670 | + param.setValue("mc_\(videoId)", forKey: "topicId") | |
| 671 | + } | |
| 672 | + | |
| 673 | + let signStr = CNLiveBusinessTools.signvalue(param as! [AnyHashable : Any]) | |
| 674 | + let string1 = "\(signStr)&key=\(CNLiveMCEnvironmentManager.shared.appKey)" | |
| 675 | + let signString1 = CNLiveBusinessTools.sha1(string1).uppercased() | |
| 676 | + param.setValue(signString1, forKey: "sign") | |
| 677 | + | |
| 678 | + let custom_param = NSMutableDictionary() | |
| 679 | + custom_param.setValue(CNLiveMCEnvironmentManager.shared.appId, forKey: "appId") | |
| 680 | + custom_param.setValue(CNLiveMCEnvironmentManager.shared.appKey, forKey: "appKey") | |
| 681 | + CNLiveNetworking.setAllowRequestDefaultArgument(false) | |
| 682 | + CNLiveNetworking.setupShowDataResult(false) | |
| 683 | +// CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | |
| 684 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseTokenUrl+"/commentServices/commentForUgc/reportComment", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | |
| 685 | + hiddenLoading() | |
| 686 | + if (error == nil) { | |
| 687 | + let resp = result as! NSDictionary | |
| 688 | + let errorCode = "\(resp["errorCode"] ?? "0")" | |
| 689 | + if (errorCode == "0") { | |
| 690 | + reultShortVideoBlock("成功", .success) | |
| 691 | + } else { | |
| 692 | +// showMessage(message: resp["errorMessage"] as! String) | |
| 693 | + reultShortVideoBlock(NSNull(),.failed) | |
| 694 | + } | |
| 695 | + } else { | |
| 696 | + if CNLiveNetworking.isNetworking() { | |
| 697 | + showMessage(message: "请求失败") | |
| 698 | + reultShortVideoBlock(NSNull(),.failed) | |
| 699 | + } else { | |
| 700 | + showMessage(message: "似乎与网络断开链接") | |
| 701 | + reultShortVideoBlock(NSNull(),.noNetwork) | |
| 702 | + } | |
| 703 | + } | |
| 704 | + } | |
| 705 | + } | |
| 706 | + | |
| 648 | 707 | } | ... | ... |