Commit 42057c6e1dfd58490e86315eb92e54e2b0aaf270

Authored by “张旭”
1 parent 479d4634

专辑付费 时 ,逻辑 ,刷新页面 , 苹果内购

metaCode.xcodeproj/project.pbxproj
@@ -199,6 +199,7 @@ @@ -199,6 +199,7 @@
199 196A55F52D95432B00B06DB7 /* CNLiveVodLandscapeBeiSuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 196A55F42D95432B00B06DB7 /* CNLiveVodLandscapeBeiSuView.swift */; }; 199 196A55F52D95432B00B06DB7 /* CNLiveVodLandscapeBeiSuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 196A55F42D95432B00B06DB7 /* CNLiveVodLandscapeBeiSuView.swift */; };
200 196A55F72D963ACE00B06DB7 /* CNLiveVodLandscapeXuanjiView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 196A55F62D963ACE00B06DB7 /* CNLiveVodLandscapeXuanjiView.swift */; }; 200 196A55F72D963ACE00B06DB7 /* CNLiveVodLandscapeXuanjiView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 196A55F62D963ACE00B06DB7 /* CNLiveVodLandscapeXuanjiView.swift */; };
201 196A55F92D963AE700B06DB7 /* CNLiveVodLandscapeGaoqingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 196A55F82D963AE600B06DB7 /* CNLiveVodLandscapeGaoqingView.swift */; }; 201 196A55F92D963AE700B06DB7 /* CNLiveVodLandscapeGaoqingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 196A55F82D963AE600B06DB7 /* CNLiveVodLandscapeGaoqingView.swift */; };
  202 + 196A55FB2D9BE7DC00B06DB7 /* CNLiveVodPayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 196A55FA2D9BE7DC00B06DB7 /* CNLiveVodPayView.swift */; };
202 197325D22BB11C18002E41A3 /* DatabaseManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 197325D12BB11C18002E41A3 /* DatabaseManager.swift */; }; 203 197325D22BB11C18002E41A3 /* DatabaseManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 197325D12BB11C18002E41A3 /* DatabaseManager.swift */; };
203 1975636E2C5A2EB2004E0F42 /* CNLiveVitaeWorkDetailController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1975636D2C5A2EB2004E0F42 /* CNLiveVitaeWorkDetailController.swift */; }; 204 1975636E2C5A2EB2004E0F42 /* CNLiveVitaeWorkDetailController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1975636D2C5A2EB2004E0F42 /* CNLiveVitaeWorkDetailController.swift */; };
204 197563712C5A3151004E0F42 /* CNLiveVitaeWorkCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 197563702C5A3151004E0F42 /* CNLiveVitaeWorkCell.swift */; }; 205 197563712C5A3151004E0F42 /* CNLiveVitaeWorkCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 197563702C5A3151004E0F42 /* CNLiveVitaeWorkCell.swift */; };
@@ -601,6 +602,7 @@ @@ -601,6 +602,7 @@
601 196A55F42D95432B00B06DB7 /* CNLiveVodLandscapeBeiSuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveVodLandscapeBeiSuView.swift; sourceTree = "<group>"; }; 602 196A55F42D95432B00B06DB7 /* CNLiveVodLandscapeBeiSuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveVodLandscapeBeiSuView.swift; sourceTree = "<group>"; };
602 196A55F62D963ACE00B06DB7 /* CNLiveVodLandscapeXuanjiView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveVodLandscapeXuanjiView.swift; sourceTree = "<group>"; }; 603 196A55F62D963ACE00B06DB7 /* CNLiveVodLandscapeXuanjiView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveVodLandscapeXuanjiView.swift; sourceTree = "<group>"; };
603 196A55F82D963AE600B06DB7 /* CNLiveVodLandscapeGaoqingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveVodLandscapeGaoqingView.swift; sourceTree = "<group>"; }; 604 196A55F82D963AE600B06DB7 /* CNLiveVodLandscapeGaoqingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveVodLandscapeGaoqingView.swift; sourceTree = "<group>"; };
  605 + 196A55FA2D9BE7DC00B06DB7 /* CNLiveVodPayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveVodPayView.swift; sourceTree = "<group>"; };
604 197325D12BB11C18002E41A3 /* DatabaseManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseManager.swift; sourceTree = "<group>"; }; 606 197325D12BB11C18002E41A3 /* DatabaseManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseManager.swift; sourceTree = "<group>"; };
605 1975636D2C5A2EB2004E0F42 /* CNLiveVitaeWorkDetailController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveVitaeWorkDetailController.swift; sourceTree = "<group>"; }; 607 1975636D2C5A2EB2004E0F42 /* CNLiveVitaeWorkDetailController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveVitaeWorkDetailController.swift; sourceTree = "<group>"; };
606 197563702C5A3151004E0F42 /* CNLiveVitaeWorkCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveVitaeWorkCell.swift; sourceTree = "<group>"; }; 608 197563702C5A3151004E0F42 /* CNLiveVitaeWorkCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveVitaeWorkCell.swift; sourceTree = "<group>"; };
@@ -1490,6 +1492,7 @@ @@ -1490,6 +1492,7 @@
1490 196A55F42D95432B00B06DB7 /* CNLiveVodLandscapeBeiSuView.swift */, 1492 196A55F42D95432B00B06DB7 /* CNLiveVodLandscapeBeiSuView.swift */,
1491 196A55F82D963AE600B06DB7 /* CNLiveVodLandscapeGaoqingView.swift */, 1493 196A55F82D963AE600B06DB7 /* CNLiveVodLandscapeGaoqingView.swift */,
1492 196A55F62D963ACE00B06DB7 /* CNLiveVodLandscapeXuanjiView.swift */, 1494 196A55F62D963ACE00B06DB7 /* CNLiveVodLandscapeXuanjiView.swift */,
  1495 + 196A55FA2D9BE7DC00B06DB7 /* CNLiveVodPayView.swift */,
1493 ); 1496 );
1494 path = HengPing; 1497 path = HengPing;
1495 sourceTree = "<group>"; 1498 sourceTree = "<group>";
@@ -2380,6 +2383,7 @@ @@ -2380,6 +2383,7 @@
2380 1909DCA72C637378001E7986 /* CNLiveDigitalResumePreviewFiveCell.swift in Sources */, 2383 1909DCA72C637378001E7986 /* CNLiveDigitalResumePreviewFiveCell.swift in Sources */,
2381 19B711872D55FE130000872A /* CNLiveDownSlideBannerCell.swift in Sources */, 2384 19B711872D55FE130000872A /* CNLiveDownSlideBannerCell.swift in Sources */,
2382 19F1C2332AB5728B0083D06C /* CNIDCardView.swift in Sources */, 2385 19F1C2332AB5728B0083D06C /* CNIDCardView.swift in Sources */,
  2386 + 196A55FB2D9BE7DC00B06DB7 /* CNLiveVodPayView.swift in Sources */,
2383 19C0F7692BD9F9F70097CC8F /* CNThreeLoginViewController.swift in Sources */, 2387 19C0F7692BD9F9F70097CC8F /* CNThreeLoginViewController.swift in Sources */,
2384 191732F32B084DBC007BCC04 /* CNLiveShopClassifySwitchTableViewCell.swift in Sources */, 2388 191732F32B084DBC007BCC04 /* CNLiveShopClassifySwitchTableViewCell.swift in Sources */,
2385 191732E72B0615C1007BCC04 /* UIScrollView+CNLiveExtensions.swift in Sources */, 2389 191732E72B0615C1007BCC04 /* UIScrollView+CNLiveExtensions.swift in Sources */,
metaCode/Classes/Main/HuBiLieHomePage/Controller/CNLiveTVPlayerViewController.swift
@@ -10,9 +10,22 @@ import ZFPlayer @@ -10,9 +10,22 @@ import ZFPlayer
10 import MJRefresh 10 import MJRefresh
11 import HandyJSON 11 import HandyJSON
12 import CNLiveShareToolKit 12 import CNLiveShareToolKit
  13 +import CNLivePayCostModule
13 14
14 class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITableViewDelegate{ 15 class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITableViewDelegate{
15 16
  17 + //专辑付费内容记录
  18 + var payVodAlbumListModel:CNLiveVodAlbumListModel?
  19 + var payContentId = ""
  20 + var payAid = ""
  21 + var payAlbumListArr = NSMutableArray()
  22 + var payIndex = 0
  23 + var payTitle = ""
  24 + var payIsAlbum = false
  25 + var payActivityId = ""
  26 + var isPayZhuanJi = false
  27 +
  28 +
16 var player: ZFPlayerController! 29 var player: ZFPlayerController!
17 //当前内容id 30 //当前内容id
18 var contentId = "" 31 var contentId = ""
@@ -324,6 +337,57 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -324,6 +337,57 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
324 } 337 }
325 self.controlView.showTitle(title, cover: UIImage.imageWithColor(color: .darkGray, size: CGSize(width: 50, height: 50)), fullScreenMode: .landscape) 338 self.controlView.showTitle(title, cover: UIImage.imageWithColor(color: .darkGray, size: CGSize(width: 50, height: 50)), fullScreenMode: .landscape)
326 self.playTitle = title 339 self.playTitle = title
  340 + self.controlView.vodPlayerPayBlock = {[weak self] in
  341 + guard let self = self else { return }
  342 + //支付按钮,拉起内购
  343 + //成功用pay参数 刷新页面
  344 +
  345 + let orderId = CNLiveHomePageViewModel.getRandomOrderId()
  346 + let notifyUrl = "http://apps.pay.cnlive.com/upappnotify/notify/orderForVideo"
  347 + //分转元,没有小数点
  348 + let fenString = self.payVodAlbumListModel?.product?.iosRmb ?? "100"
  349 + // 将字符串转换为整数
  350 + // 使用guard语句确保字符串可以转换为整数
  351 + guard let fen = Int(fenString) else {
  352 + print("无法将字符串转换为整数")
  353 + return
  354 + }
  355 + // 计算元值(整数除法,自动舍去小数部分)
  356 + var yuan = fen / 100
  357 + if yuan <= 0{//如果是测试0.1元 ,线上默认设置为1元
  358 + yuan = 1
  359 + }
  360 + // 将结果转换为字符串
  361 + let yuanString = String(yuan)
  362 +
  363 + let prdId = "com.cnlive.metaCode."+yuanString//"com.cnlive.metaCode."+"1"//+(viewcell.homeModel.albumMsgModel?.product?.iosRmb ?? "1")
  364 +
  365 + let body = self.payVodAlbumListModel?.product?.productTitle ?? ""
  366 + let total_fee = yuan*100
  367 + let dataDic = NSMutableDictionary()
  368 + dataDic.setValue(body, forKey: "body")
  369 + dataDic.setValue(notifyUrl, forKey: "notify_url")
  370 + dataDic.setValue(orderId, forKey: "orderId")
  371 + dataDic.setValue(prdId, forKey: "prdId")
  372 + dataDic.setValue(total_fee, forKey: "total_fee")
  373 +
  374 + //后台设置一个 com.cnlive.meta.1 2 60 3 78
  375 + //苹果内购暂时报错 验证失败支付失败
  376 + CNLivePayCostModule.showApplePayViw(withParamDict: dataDic as! [AnyHashable : Any], fromVC: currentViewController()!) {[weak self] result in
  377 + guard let self = self else { return }
  378 + if result == CNLivePayCostTypeResultSucc{
  379 + print("succ")
  380 + //刷新页面
  381 + self.contentId = self.payContentId
  382 + self.refreshVodData(isAblumVideo: self.payIsAlbum)
  383 + self.controlView.payBgView.isHidden = true
  384 + self.player.allowOrentitaionRotation = true
  385 + }
  386 +
  387 + }
  388 +
  389 +
  390 + }
327 self.controlView.controlGaoqingUpdateBlock = { [weak self] gaoqing in 391 self.controlView.controlGaoqingUpdateBlock = { [weak self] gaoqing in
328 guard let self = self else { return } 392 guard let self = self else { return }
329 // 393 //
@@ -444,7 +508,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -444,7 +508,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
444 func destroyPlayer(){ 508 func destroyPlayer(){
445 self.player.stop() 509 self.player.stop()
446 } 510 }
447 - 511 +
448 // MARK: - 专辑/看点 列表切换某集,只刷新播放器和点赞收藏 512 // MARK: - 专辑/看点 列表切换某集,只刷新播放器和点赞收藏
449 func kanDianOrAlbumChangeContentApi(contentId:String,title:String,isAlbum:Bool,activeId:String){ 513 func kanDianOrAlbumChangeContentApi(contentId:String,title:String,isAlbum:Bool,activeId:String){
450 // if isAlbum{ 514 // if isAlbum{
@@ -581,19 +645,21 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -581,19 +645,21 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
581 } 645 }
582 646
583 } 647 }
584 - // MARK: - 刷新 整个页面 648 + // MARK: - 专辑刷新整个页面
585 func refreshVodData(isAblumVideo:Bool){ 649 func refreshVodData(isAblumVideo:Bool){
586 - CNLiveDownSlideTool.getVodData(contentId: self.contentId, isAblumVideo: isAblumVideo) {[weak self] vodPlayModel, contentId,url, result, status in 650 + CNLiveDownSlideTool.getVodData(contentId: self.payAid, isAblumVideo: isAblumVideo,seleContentId: self.payContentId) {[weak self] vodPlayModel, contentId,url, result, status in
  651 + guard let self = self else { return }
587 if status == .success{ 652 if status == .success{
588 - self!.vodPlayModel = vodPlayModel  
589 - self!.contentId = contentId 653 + self.vodPlayModel = vodPlayModel
  654 + self.contentId = contentId
590 if let vodAlbumListBaseModel = result{ 655 if let vodAlbumListBaseModel = result{
591 - self!.vodAlbumListBaseModel = vodAlbumListBaseModel 656 + self.vodAlbumListBaseModel = vodAlbumListBaseModel
592 } 657 }
593 - self!.url = URL(string: url)  
594 - self!.configDataArray()  
595 - self!.tableView.mj_header?.endRefreshing()  
596 - self!.tableView.reloadData() 658 + self.url = URL(string: url)
  659 + self.configDataArray()
  660 + self.albumIndex = self.payIndex
  661 + self.tableView.mj_header?.endRefreshing()
  662 + self.tableView.reloadData()
597 var title = "" 663 var title = ""
598 for (_,mdl) in vodPlayModel.blockList.enumerated(){ 664 for (_,mdl) in vodPlayModel.blockList.enumerated(){
599 if mdl.type == "5" && mdl.list.count > 0 {//点播详情数据 665 if mdl.type == "5" && mdl.list.count > 0 {//点播详情数据
@@ -603,7 +669,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -603,7 +669,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
603 } 669 }
604 } 670 }
605 } 671 }
606 - self!.playWithUrlAndTitle(url: url, title: title) 672 + self.playWithUrlAndTitle(url: url, title: title)
607 }else{ 673 }else{
608 674
609 } 675 }
@@ -691,13 +757,68 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -691,13 +757,68 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
691 757
692 cell.selectBlock = {[weak self] vodModel, index ,albumListArr in 758 cell.selectBlock = {[weak self] vodModel, index ,albumListArr in
693 guard let self = self else { return } 759 guard let self = self else { return }
694 - self.contentId = vodModel.contentId  
695 - self.albumListArr = albumListArr  
696 - self.albumIndex = index  
697 - self.kanDianIndex = -1  
698 - self.isPlayAblumOrKandian = true  
699 - self.kanDianOrAlbumChangeContentApi(contentId: vodModel.contentId, title: vodModel.title, isAlbum: true, activeId: vodModel.activityId)  
700 -// self.changeContentApi(vodModel: vodModel) 760 + self.player.currentPlayerManager.pause()
  761 + isPayZhuanJi = false//是否付过费
  762 + var yuanString = "1"
  763 + if vodModel.product?.check == true {
  764 + //免费或者付过费了
  765 + self.controlView.payBgView.isHidden = true
  766 + isPayZhuanJi = true
  767 + } else {
  768 + if vodModel.product?.productType == "4" {
  769 + //这里表示可以进行试听
  770 + self.controlView.payBgView.isHidden = true
  771 + isPayZhuanJi = true
  772 + } else {
  773 + //需要付费
  774 + self.controlView.payBgView.isHidden = false
  775 + isPayZhuanJi = false
  776 + //分转元,没有小数点
  777 + let fenString = vodModel.product!.iosRmb
  778 + // 将字符串转换为整数
  779 + // 使用guard语句确保字符串可以转换为整数
  780 + guard let fen = Int(fenString) else {
  781 + print("无法将字符串转换为整数")
  782 + return
  783 + }
  784 + // 计算元值(整数除法,自动舍去小数部分)
  785 + var yuan = fen / 100
  786 + if yuan <= 0{//如果是测试0.1元 ,线上默认设置为1元
  787 + yuan = 1
  788 + }
  789 + // 将结果转换为字符串
  790 + yuanString = String(yuan)
  791 + }
  792 + }
  793 +
  794 + if isPayZhuanJi{
  795 + //已经付费
  796 + self.controlView.payBgView.isHidden = true
  797 + self.contentId = vodModel.contentId
  798 + self.albumListArr = albumListArr
  799 + self.albumIndex = index
  800 + self.kanDianIndex = -1
  801 + self.isPlayAblumOrKandian = true
  802 + self.kanDianOrAlbumChangeContentApi(contentId: vodModel.contentId, title: vodModel.title, isAlbum: true, activeId: vodModel.activityId)
  803 + self.player.allowOrentitaionRotation = true
  804 + }else{
  805 + //没付费
  806 + //显示付费页面
  807 + self.controlView.payBgView.isHidden = false
  808 + self.controlView.payBgView.payBtn.setTitle("\(yuanString)元购买本专辑", for: .normal)
  809 + //成功用pay参数 刷新页面
  810 + self.payVodAlbumListModel = vodModel
  811 + self.payAid = vodModel.albumId//.contentId
  812 + self.payContentId = vodModel.contentId
  813 + self.payAlbumListArr = albumListArr
  814 + self.payIndex = index
  815 + self.kanDianIndex = -1
  816 + self.isPlayAblumOrKandian = true
  817 + self.payTitle = vodModel.title
  818 + self.payIsAlbum = true
  819 + self.payActivityId = vodModel.activityId
  820 + self.player.allowOrentitaionRotation = false
  821 + }
701 } 822 }
702 return cell 823 return cell
703 }else if let vodPlayShopModels = self.dataArray[indexPath.row] as? [CNLiveVodPlayShopModel]{ 824 }else if let vodPlayShopModels = self.dataArray[indexPath.row] as? [CNLiveVodPlayShopModel]{
metaCode/Classes/Main/HuBiLieHomePage/Util/CNLiveDownSlideTool.swift
@@ -266,15 +266,15 @@ class CNLiveDownSlideTool:NSObject{ @@ -266,15 +266,15 @@ class CNLiveDownSlideTool:NSObject{
266 navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated) 266 navigationViewController().visibleViewController?.navigationController?.pushViewController(webVC, animated: pushAnimated)
267 } 267 }
268 //刷新使用 获取点播 单集或者专辑数据 268 //刷新使用 获取点播 单集或者专辑数据
269 - class func getVodData(contentId:String,isAblumVideo:Bool,resultBlock: @escaping downSlideVodResultBlock){ 269 + class func getVodData(contentId:String,isAblumVideo:Bool,seleContentId:String,resultBlock: @escaping downSlideVodResultBlock){
270 showLoading(message: "") 270 showLoading(message: "")
271 if isAblumVideo{ 271 if isAblumVideo{
272 //专辑 272 //专辑
273 - //获取专辑详情 273 + //获取专辑详情 contentId:2653
274 CNLiveDownSlideTool.getVodAlbumMsgApi(contentId: contentId){result, status in 274 CNLiveDownSlideTool.getVodAlbumMsgApi(contentId: contentId){result, status in
275 if status == .success{ 275 if status == .success{
276 if let vodModel = result as? CNLiveVodAlbumMsgModel{ 276 if let vodModel = result as? CNLiveVodAlbumMsgModel{
277 - //获取专辑列表 277 + //获取专辑列表 contentId:2653
278 CNLiveHomePageViewModel.requstWithVodAlbumVideoList(aid: contentId){result, status in 278 CNLiveHomePageViewModel.requstWithVodAlbumVideoList(aid: contentId){result, status in
279 hiddenLoading() 279 hiddenLoading()
280 if let albumListBaseModel = result as? CNLiveVodAlbumListBaseModel{ 280 if let albumListBaseModel = result as? CNLiveVodAlbumListBaseModel{
@@ -283,10 +283,10 @@ class CNLiveDownSlideTool:NSObject{ @@ -283,10 +283,10 @@ class CNLiveDownSlideTool:NSObject{
283 albumListModel.vodAlbumMsgModel = vodModel 283 albumListModel.vodAlbumMsgModel = vodModel
284 if idx == vodModel.episodeLast{ 284 if idx == vodModel.episodeLast{
285 currVodModel = 285 currVodModel =
286 - albumListModel } 286 + albumListModel}
287 } 287 }
288 //拿最新播放集数的单集pid,再请求play 288 //拿最新播放集数的单集pid,再请求play
289 - CNLiveDownSlideTool.getVodPlayApi(contentId: currVodModel?.contentId ?? ""){ result, status in 289 + CNLiveDownSlideTool.getVodPlayApi(contentId:(seleContentId.count>0 ? seleContentId : currVodModel?.contentId ?? "") ){ result, status in
290 if status == .success{ 290 if status == .success{
291 if let vodModel = result as? CNLiveVodPlayModel{ 291 if let vodModel = result as? CNLiveVodPlayModel{
292 //获得点播url 292 //获得点播url
metaCode/Classes/Main/HuBiLieHomePage/View/VodDetail/CNLiveZFPlayerControlView.swift
@@ -10,10 +10,13 @@ import ZFPlayer @@ -10,10 +10,13 @@ import ZFPlayer
10 10
11 //标清 2 ,高清 3 ,超清 4 11 //标清 2 ,高清 3 ,超清 4
12 typealias CNLiveVodPlayerControlLandscapeGaoqingUpdateBlock = (_ gaoqing:Int)->Void 12 typealias CNLiveVodPlayerControlLandscapeGaoqingUpdateBlock = (_ gaoqing:Int)->Void
  13 +typealias CNLiveVodPlayerPayBlock = ()->Void
13 14
14 class CNLiveZFPlayerControlView:ZFPlayerControlView{ 15 class CNLiveZFPlayerControlView:ZFPlayerControlView{
15 16
16 var controlGaoqingUpdateBlock:CNLiveVodPlayerControlLandscapeGaoqingUpdateBlock? 17 var controlGaoqingUpdateBlock:CNLiveVodPlayerControlLandscapeGaoqingUpdateBlock?
  18 + var vodPlayerPayBlock:CNLiveVodPlayerPayBlock?
  19 +
17 lazy var beiSuBtn: UIButton = { 20 lazy var beiSuBtn: UIButton = {
18 let closeBtn = UIButton(type: .custom) 21 let closeBtn = UIButton(type: .custom)
19 closeBtn.setTitle("倍速", for: .normal) 22 closeBtn.setTitle("倍速", for: .normal)
@@ -52,6 +55,12 @@ class CNLiveZFPlayerControlView:ZFPlayerControlView{ @@ -52,6 +55,12 @@ class CNLiveZFPlayerControlView:ZFPlayerControlView{
52 return bottomNavView 55 return bottomNavView
53 }() 56 }()
54 57
  58 + lazy var payBgView :CNLiveVodPayView = {
  59 + let bottomNavView = CNLiveVodPayView()
  60 + return bottomNavView
  61 + }()
  62 +
  63 +
55 override init(frame: CGRect) { 64 override init(frame: CGRect) {
56 super.init(frame: frame) 65 super.init(frame: frame)
57 self.initUI() 66 self.initUI()
@@ -107,6 +116,18 @@ class CNLiveZFPlayerControlView:ZFPlayerControlView{ @@ -107,6 +116,18 @@ class CNLiveZFPlayerControlView:ZFPlayerControlView{
107 self.gaoqingBgView.isHidden = true 116 self.gaoqingBgView.isHidden = true
108 self.controlGaoqingUpdateBlock?(gaoqing) 117 self.controlGaoqingUpdateBlock?(gaoqing)
109 } 118 }
  119 +
  120 + self.addSubview(self.payBgView)
  121 + payBgView.snp.makeConstraints { make in
  122 + make.left.right.top.bottom.equalToSuperview()
  123 + }
  124 + self.payBgView.isHidden = true
  125 + self.payBgView.payBlock = {
  126 + //拉起内购
  127 + self.vodPlayerPayBlock?()
  128 +
  129 + }
  130 +
110 } 131 }
111 132
112 override func layoutSubviews() { 133 override func layoutSubviews() {
metaCode/Classes/Main/HuBiLieHomePage/View/VodDetail/HengPing/CNLiveVodPayView.swift 0 → 100644
  1 +//
  2 +// CNLiveVodPayView.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2025/4/1.
  6 +// 支付页面
  7 +
  8 +import Foundation
  9 +
  10 +typealias CNLiveVodPayViewPayBlock = ()->Void
  11 +
  12 +class CNLiveVodPayView:UIView{
  13 +
  14 + var payBlock:CNLiveVodPayViewPayBlock?
  15 + //MARK: - 懒加载
  16 + lazy var titleLabel: UILabel = {
  17 + let titleLbl = UILabel()
  18 + titleLbl.font = Font_12
  19 + titleLbl.textColor = HexColor("#FFFFFF")
  20 + titleLbl.text = "应版权方要求,本专辑所有用户均需付费"
  21 + return titleLbl
  22 + }()
  23 + lazy var payBtn: UIButton = {
  24 + let closeBtn = UIButton(type: .custom)
  25 + closeBtn.backgroundColor = HexColor("#F5A623", alpha: 0.14)
  26 + closeBtn.layer.borderColor = HexColor("#F5A623")?.cgColor
  27 + closeBtn.layer.borderWidth = 0.5
  28 + closeBtn.clipsToBounds = true
  29 + closeBtn.layer.cornerRadius = 6
  30 + closeBtn.setTitleColor(HexColor("#F5A623"), for: .normal)
  31 + closeBtn.setTitle("元购买本专辑", for: .normal)
  32 + closeBtn.titleLabel?.font = Font_12
  33 + closeBtn.addTarget(self, action: #selector(payBtnAction), for: .touchUpInside)
  34 + return closeBtn
  35 + }()
  36 +
  37 + lazy var landscapeBackBtn: UIButton = {
  38 + let backBtn = UIButton.backItem(imageName: ("mine_header_icon_white_back"), target: self, action: #selector(landscapeBackBtnAction))
  39 + backBtn.frame = CGRect(x: 15, y: KStatusBarHeight, width: 60, height: 30)
  40 + return backBtn
  41 + }()
  42 +
  43 +
  44 + override init(frame: CGRect) {
  45 + super.init(frame: frame)
  46 + self.backgroundColor = HexColor("#000000", alpha: 0.7)
  47 + self.isUserInteractionEnabled = true
  48 + self.initUI()
  49 + self.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(tapAction)))
  50 + }
  51 +
  52 + required init?(coder: NSCoder) {
  53 + fatalError("init(coder:) has not been implemented")
  54 + }
  55 +
  56 + func initUI(){
  57 +
  58 +// self.addSubview(self.landscapeBackBtn)
  59 +
  60 + self.addSubview(self.titleLabel)
  61 +
  62 + self.addSubview(self.payBtn)
  63 + payBtn.snp.makeConstraints { make in
  64 + make.center.equalToSuperview()
  65 + make.width.equalTo(117)
  66 + make.height.equalTo(30)
  67 + }
  68 + titleLabel.snp.makeConstraints { make in
  69 + make.bottom.equalTo(self.payBtn.snp.top).offset(-15)
  70 + make.centerX.equalToSuperview()
  71 + }
  72 + }
  73 +
  74 + @objc func payBtnAction(){
  75 + //拉起支付
  76 + self.payBlock?()
  77 + }
  78 +
  79 + @objc func tapAction(){
  80 +// self.isHidden = true
  81 + }
  82 +
  83 + @objc func landscapeBackBtnAction(){
  84 + let viewControllers = navigationViewController().viewControllers
  85 + if viewControllers.count > 1 {
  86 + if viewControllers.last == self {
  87 + navigationViewController().popViewController(animated: true)
  88 + }
  89 + }
  90 + }
  91 +}
  92 +