Commit 3a78176bb7cb21db5548373729703594cd68eafb

Authored by “张旭”
1 parent c772e303

优化点播详情页点击专辑或者看点刷新看点和相关推荐

metaCode/Classes/Main/HuBiLieHomePage/Controller/CNLiveTVPlayerViewController.swift
@@ -352,7 +352,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -352,7 +352,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
352 } 352 }
353 self.isPlayAblumOrKandian = false 353 self.isPlayAblumOrKandian = false
354 self.kanDianIndex = seleIndex 354 self.kanDianIndex = seleIndex
355 - self.kanDianOrAlbumChangeContentApi(contentId: vodPlayBlockListListModel.contentId, title: vodPlayBlockListListModel.title, isAlbum: isAblumVideo, activeId: vodPlayBlockListListModel.pid) 355 + self.kanDianOrAlbumChangeContentApi(contentId: vodPlayBlockListListModel.contentId, title: vodPlayBlockListListModel.title, isAlbum: isAblumVideo, activeId: vodPlayBlockListListModel.pid, isRefreshPlayer:true )
356 356
357 } 357 }
358 358
@@ -409,7 +409,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -409,7 +409,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
409 self.albumIndex = 0 409 self.albumIndex = 0
410 self.kanDianIndex = -1 410 self.kanDianIndex = -1
411 self.isPlayAblumOrKandian = true 411 self.isPlayAblumOrKandian = true
412 - self.kanDianOrAlbumChangeContentApi(contentId: self.vodPlayModel?.contentId ?? "", title: title, isAlbum: true, activeId: self.vodPlayModel?.contentId ?? "") 412 + self.kanDianOrAlbumChangeContentApi(contentId: self.vodPlayModel?.contentId ?? "", title: title, isAlbum: true, activeId: self.vodPlayModel?.contentId ?? "", isRefreshPlayer: true)
413 self.player.allowOrentitaionRotation = true 413 self.player.allowOrentitaionRotation = true
414 }else{ 414 }else{
415 //没付费 415 //没付费
@@ -556,7 +556,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -556,7 +556,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
556 if let albumModel = self.albumListArr[nextIdx] as? CNLiveVodAlbumListModel{ 556 if let albumModel = self.albumListArr[nextIdx] as? CNLiveVodAlbumListModel{
557 //播专辑列表下一条 557 //播专辑列表下一条
558 self.contentId = albumModel.contentId 558 self.contentId = albumModel.contentId
559 - self.kanDianOrAlbumChangeContentApi(contentId: albumModel.contentId, title: albumModel.title, isAlbum: self.isAblumVideo, activeId: albumModel.activityId) 559 + self.kanDianOrAlbumChangeContentApi(contentId: albumModel.contentId, title: albumModel.title, isAlbum: self.isAblumVideo, activeId: albumModel.activityId, isRefreshPlayer: true)
560 // self.changeContentApi(vodModel: albumModel) 560 // self.changeContentApi(vodModel: albumModel)
561 } 561 }
562 562
@@ -574,7 +574,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -574,7 +574,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
574 //播列表下一条 574 //播列表下一条
575 let isAblumVideo = (albumModel.album?.albumId.count ?? 0 > 0) ? true : false 575 let isAblumVideo = (albumModel.album?.albumId.count ?? 0 > 0) ? true : false
576 // if isAblumVideo{ 576 // if isAblumVideo{
577 - self.kanDianOrAlbumChangeContentApi(contentId: albumModel.contentId, title: albumModel.title, isAlbum: isAblumVideo, activeId: albumModel.pid) 577 + self.kanDianOrAlbumChangeContentApi(contentId: albumModel.contentId, title: albumModel.title, isAlbum: isAblumVideo, activeId: albumModel.pid, isRefreshPlayer: true)
578 // }else{ 578 // }else{
579 // self.kanDianOrAlbumChangeContentApi(contentId: albumModel.contentId, title: albumModel.title, isAlbum: isAblumVideo, activeId: albumModel.pid) 579 // self.kanDianOrAlbumChangeContentApi(contentId: albumModel.contentId, title: albumModel.title, isAlbum: isAblumVideo, activeId: albumModel.pid)
580 // } 580 // }
@@ -659,74 +659,74 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -659,74 +659,74 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
659 self.player.stop() 659 self.player.stop()
660 } 660 }
661 661
662 - // MARK: - 专辑/看点 列表切换某集,只刷新播放器和点赞收藏  
663 - func kanDianOrAlbumChangeContentApi(contentId:String,title:String,isAlbum:Bool,activeId:String){ 662 + // MARK: - 专辑/看点 列表切换某集
  663 + func kanDianOrAlbumChangeContentApi(contentId:String,title:String,isAlbum:Bool,activeId:String, isRefreshPlayer: Bool){
664 // if isAlbum{ 664 // if isAlbum{
665 - self.changeContentApi(activityId: activeId, title: title, contentId: contentId) 665 + self.changeContentApi(activityId: activeId, title: title, contentId: contentId, isRefreshPlayer: isRefreshPlayer)
666 // }else{ 666 // }else{
667 // self.kanDianChangeContentApi(contentId: contentId, title: title) 667 // self.kanDianChangeContentApi(contentId: contentId, title: title)
668 // } 668 // }
669 } 669 }
670 // MARK: - 看点列表切换某集 只刷新播放器和点赞收藏 670 // MARK: - 看点列表切换某集 只刷新播放器和点赞收藏
671 - func kanDianChangeContentApi(contentId:String,title:String){  
672 - self.isPlayAblumOrKandian = false  
673 - //刷新url  
674 - CNLiveHomePageViewModel.shared.getVodVideoURL(contentId: contentId) {[weak self] result, status in  
675 - guard let self = self else { return }  
676 - if status == .success  
677 - {  
678 - if let url = result as? String{  
679 - self.playWithUrlAndTitle(url: url, title: title)  
680 - self.url = URL(string: url)  
681 - }  
682 - }else{  
683 -  
684 - }  
685 - }  
686 -  
687 - //play接口刷新 看点和电商  
688 - CNLiveDownSlideTool.getVodPlayApi(contentId: contentId) {[weak self] result, status in  
689 - guard let self = self else { return }  
690 - if status == .success{  
691 - if let vodPlayModel = result as? CNLiveVodPlayModel{  
692 -// self.vodPlayModel = vodPlayModel  
693 - //单集有值-简介  
694 - var index = 0  
695 - var isReplace = false  
696 - var tempMdl:CNLiveVodPlayBlockListModel?  
697 - for (idx,mdl) in self.dataArray.enumerated(){  
698 - if var tempVodMdl = mdl as? CNLiveVodPlayBlockListModel{  
699 - if tempVodMdl.type == "5"{//点播详情数据  
700 -  
701 - for (_,vodMdl) in vodPlayModel.blockList.enumerated(){  
702 - if vodMdl.type == "5"{  
703 - tempMdl = vodMdl  
704 - index = idx  
705 - isReplace = true  
706 - }  
707 - }  
708 - }  
709 - }  
710 - }  
711 - if isReplace{  
712 - self.dataArray.replaceObject(at: index, with: tempMdl as Any)  
713 - }else{}  
714 - self.controlView.vodPlayModel = vodPlayModel  
715 - self.configDataArray()  
716 - self.tableView.reloadData()  
717 - }else{  
718 -  
719 - }  
720 - }else{  
721 -  
722 - }  
723 - }  
724 -  
725 - } 671 +// func kanDianChangeContentApi(contentId:String,title:String){
  672 +// self.isPlayAblumOrKandian = false
  673 +// //刷新url
  674 +// CNLiveHomePageViewModel.shared.getVodVideoURL(contentId: contentId) {[weak self] result, status in
  675 +// guard let self = self else { return }
  676 +// if status == .success
  677 +// {
  678 +// if let url = result as? String{
  679 +// self.playWithUrlAndTitle(url: url, title: title)
  680 +// self.url = URL(string: url)
  681 +// }
  682 +// }else{
  683 +//
  684 +// }
  685 +// }
  686 +//
  687 +// //play接口刷新 看点和电商
  688 +// CNLiveDownSlideTool.getVodPlayApi(contentId: contentId) {[weak self] result, status in
  689 +// guard let self = self else { return }
  690 +// if status == .success{
  691 +// if let vodPlayModel = result as? CNLiveVodPlayModel{
  692 +//// self.vodPlayModel = vodPlayModel
  693 +// //单集有值-简介
  694 +// var index = 0
  695 +// var isReplace = false
  696 +// var tempMdl:CNLiveVodPlayBlockListModel?
  697 +// for (idx,mdl) in self.dataArray.enumerated(){
  698 +// if var tempVodMdl = mdl as? CNLiveVodPlayBlockListModel{
  699 +// if tempVodMdl.type == "5"{//点播详情数据
  700 +//
  701 +// for (_,vodMdl) in vodPlayModel.blockList.enumerated(){
  702 +// if vodMdl.type == "5"{
  703 +// tempMdl = vodMdl
  704 +// index = idx
  705 +// isReplace = true
  706 +// }
  707 +// }
  708 +// }
  709 +// }
  710 +// }
  711 +// if isReplace{
  712 +// self.dataArray.replaceObject(at: index, with: tempMdl as Any)
  713 +// }else{}
  714 +// self.controlView.vodPlayModel = vodPlayModel
  715 +// self.configDataArray()
  716 +// self.tableView.reloadData()
  717 +// }else{
  718 +//
  719 +// }
  720 +// }else{
  721 +//
  722 +// }
  723 +// }
  724 +//
  725 +// }
726 726
727 727
728 - // MARK: -专辑列表切换某集 ,刷新看点和电商  
729 - func changeContentApi(activityId:String,title:String,contentId:String){ 728 + // MARK: -专辑/看点 列表切换某集 ,刷新看点和电商
  729 + func changeContentApi(activityId:String,title:String,contentId:String,isRefreshPlayer:Bool){
730 // self.isPlayAblumOrKandian = true 730 // self.isPlayAblumOrKandian = true
731 731
732 //play接口刷新 看点和电商 1350755 732 //play接口刷新 看点和电商 1350755
@@ -773,16 +773,18 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -773,16 +773,18 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
773 self.controlView.vodPlayModel = tempVodPlayModel 773 self.controlView.vodPlayModel = tempVodPlayModel
774 774
775 //刷新url 1955_71512cfbcd5b497580732b48e26d16d6 775 //刷新url 1955_71512cfbcd5b497580732b48e26d16d6
776 - CNLiveHomePageViewModel.shared.getVodVideoURL(contentId: activityId) {[weak self] result, status in  
777 - guard let self = self else { return }  
778 - if status == .success  
779 - {  
780 - if let url = result as? String{  
781 - self.playWithUrlAndTitle(url: url, title: title)  
782 - self.url = URL(string: url) 776 + if isRefreshPlayer{
  777 + CNLiveHomePageViewModel.shared.getVodVideoURL(contentId: activityId) {[weak self] result, status in
  778 + guard let self = self else { return }
  779 + if status == .success
  780 + {
  781 + if let url = result as? String{
  782 + self.playWithUrlAndTitle(url: url, title: title)
  783 + self.url = URL(string: url)
  784 + }
  785 + }else{
  786 +
783 } 787 }
784 - }else{  
785 -  
786 } 788 }
787 } 789 }
788 790
@@ -876,10 +878,12 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -876,10 +878,12 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
876 } 878 }
877 cell.currSeleIdx = self.kanDianIndex//-1 879 cell.currSeleIdx = self.kanDianIndex//-1
878 cell.vodPlayBlockListModel = vodPlayBlockListModel 880 cell.vodPlayBlockListModel = vodPlayBlockListModel
  881 + ////看点展开
879 cell.expandBlock = { [weak self] model in 882 cell.expandBlock = { [weak self] model in
880 guard let self = self else { return } 883 guard let self = self else { return }
881 self.trailersCellDetailBtnAction(vodPlayBlockListModel: model) 884 self.trailersCellDetailBtnAction(vodPlayBlockListModel: model)
882 } 885 }
  886 + ////看点点击
883 cell.selectBlock = { [weak self] model,index,kanDianListArr in 887 cell.selectBlock = { [weak self] model,index,kanDianListArr in
884 guard let self = self else { return } 888 guard let self = self else { return }
885 //点击看点 889 //点击看点
@@ -927,7 +931,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -927,7 +931,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
927 //kanDianListArr cnLivevodPlayBlocjListlistModel 931 //kanDianListArr cnLivevodPlayBlocjListlistModel
928 self.controlView.xuanjiBgView.currSeleIdx = index 932 self.controlView.xuanjiBgView.currSeleIdx = index
929 self.controlView.xuanjiBgView.kanDianListArr = kanDianListArr 933 self.controlView.xuanjiBgView.kanDianListArr = kanDianListArr
930 - self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid) 934 + self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid, isRefreshPlayer:true )
931 self.player.allowOrentitaionRotation = true 935 self.player.allowOrentitaionRotation = true
932 }else{ 936 }else{
933 //没付费 937 //没付费
@@ -939,16 +943,23 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -939,16 +943,23 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
939 self.controlView.vodPlayModel = vodMdl 943 self.controlView.vodPlayModel = vodMdl
940 self.controlView.payBgView.isHidden = false 944 self.controlView.payBgView.isHidden = false
941 self.controlView.payBgView.payBtn.setTitle("\(yuanString)元购买本集内容", for: .normal) 945 self.controlView.payBgView.payBtn.setTitle("\(yuanString)元购买本集内容", for: .normal)
  946 +
  947 + self.contentId = model.contentId
  948 + let isAblumVideo = (model.album?.albumId.count ?? 0 > 0) ? true : false
  949 + self.albumIndex = -1
  950 + self.kanDianIndex = index
  951 + self.kanDianListArr = kanDianListArr
  952 + self.isPlayAblumOrKandian = false
  953 +
942 //成功用pay参数 刷新页面 954 //成功用pay参数 刷新页面
943 self.payVodProductModel = model.product 955 self.payVodProductModel = model.product
944 self.payContentId = model.contentId 956 self.payContentId = model.contentId
945 self.payIndex = -1 957 self.payIndex = -1
946 - self.kanDianIndex = index  
947 - self.isPlayAblumOrKandian = false  
948 self.payTitle = model.title 958 self.payTitle = model.title
949 self.payIsAlbum = false 959 self.payIsAlbum = false
950 self.payActivityId = model.pid 960 self.payActivityId = model.pid
951 self.player.allowOrentitaionRotation = false 961 self.player.allowOrentitaionRotation = false
  962 + self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid, isRefreshPlayer:false )
952 } 963 }
953 } 964 }
954 return cell 965 return cell
@@ -974,6 +985,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -974,6 +985,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
974 // self.controlView.xuanjiBgView.kanDianListArr = self.kanDianListArr 985 // self.controlView.xuanjiBgView.kanDianListArr = self.kanDianListArr
975 //CNLiveVodPlayblockListListModel 986 //CNLiveVodPlayblockListListModel
976 } 987 }
  988 + //点击专辑
977 cell.selectBlock = {[weak self] vodModel, index ,albumListArr in 989 cell.selectBlock = {[weak self] vodModel, index ,albumListArr in
978 guard let self = self else { return } 990 guard let self = self else { return }
979 self.player.currentPlayerManager.pause() 991 self.player.currentPlayerManager.pause()
@@ -1006,24 +1018,6 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -1006,24 +1018,6 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1006 self.controlView.payBgView.isHidden = true 1018 self.controlView.payBgView.isHidden = true
1007 isPayZhuanJi = true 1019 isPayZhuanJi = true
1008 } 1020 }
1009 -  
1010 -  
1011 -// if vodModel.product?.productType == "2" || vodModel.product?.productType == "5"{//付费  
1012 -//  
1013 -// }else{  
1014 -// if vodModel.product?.check == true {  
1015 -//  
1016 -// } else {  
1017 -// if vodModel.product?.productType == "4" {  
1018 -// //这里表示可以进行试听  
1019 -// self.controlView.payBgView.isHidden = true  
1020 -// isPayZhuanJi = true  
1021 -// } else {  
1022 -// self.controlView.payBgView.isHidden = true  
1023 -// isPayZhuanJi = true  
1024 -// }  
1025 -// }  
1026 -// }  
1027 1021
1028 if isPayZhuanJi{ 1022 if isPayZhuanJi{
1029 //已经付费 1023 //已经付费
@@ -1033,7 +1027,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -1033,7 +1027,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1033 self.albumIndex = index 1027 self.albumIndex = index
1034 self.kanDianIndex = -1 1028 self.kanDianIndex = -1
1035 self.isPlayAblumOrKandian = true 1029 self.isPlayAblumOrKandian = true
1036 - self.kanDianOrAlbumChangeContentApi(contentId: vodModel.contentId, title: vodModel.title, isAlbum: true, activeId: vodModel.activityId) 1030 + self.kanDianOrAlbumChangeContentApi(contentId: vodModel.contentId, title: vodModel.title, isAlbum: true, activeId: vodModel.activityId, isRefreshPlayer: true)
1037 self.player.allowOrentitaionRotation = true 1031 self.player.allowOrentitaionRotation = true
1038 }else{ 1032 }else{
1039 //没付费 1033 //没付费
@@ -1045,18 +1039,24 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -1045,18 +1039,24 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1045 self.controlView.vodPlayModel = vodMdl 1039 self.controlView.vodPlayModel = vodMdl
1046 self.controlView.payBgView.isHidden = false 1040 self.controlView.payBgView.isHidden = false
1047 self.controlView.payBgView.payBtn.setTitle("\(yuanString)元购买本专辑", for: .normal) 1041 self.controlView.payBgView.payBtn.setTitle("\(yuanString)元购买本专辑", for: .normal)
  1042 +
  1043 + self.contentId = vodModel.contentId
  1044 + self.albumListArr = albumListArr
  1045 + self.albumIndex = index
  1046 + self.kanDianIndex = -1
  1047 + self.isPlayAblumOrKandian = true
  1048 +
1048 //成功用pay参数 刷新页面 1049 //成功用pay参数 刷新页面
1049 self.payVodAlbumListModel = vodModel 1050 self.payVodAlbumListModel = vodModel
1050 self.payAid = vodModel.albumId//.contentId 1051 self.payAid = vodModel.albumId//.contentId
1051 self.payContentId = vodModel.contentId 1052 self.payContentId = vodModel.contentId
1052 self.payAlbumListArr = albumListArr 1053 self.payAlbumListArr = albumListArr
1053 self.payIndex = index 1054 self.payIndex = index
1054 - self.kanDianIndex = -1  
1055 - self.isPlayAblumOrKandian = true  
1056 self.payTitle = vodModel.title 1055 self.payTitle = vodModel.title
1057 self.payIsAlbum = true 1056 self.payIsAlbum = true
1058 self.payActivityId = vodModel.activityId 1057 self.payActivityId = vodModel.activityId
1059 self.player.allowOrentitaionRotation = false 1058 self.player.allowOrentitaionRotation = false
  1059 + self.kanDianOrAlbumChangeContentApi(contentId: vodModel.contentId, title: vodModel.title, isAlbum: true, activeId: vodModel.activityId, isRefreshPlayer: false)
1060 } 1060 }
1061 } 1061 }
1062 return cell 1062 return cell
@@ -1225,7 +1225,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -1225,7 +1225,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1225 //kanDianListArr cnLivevodPlayBlocjListlistModel 1225 //kanDianListArr cnLivevodPlayBlocjListlistModel
1226 self.controlView.xuanjiBgView.currSeleIdx = seleIdx 1226 self.controlView.xuanjiBgView.currSeleIdx = seleIdx
1227 self.controlView.xuanjiBgView.kanDianListArr = kanDianListArr 1227 self.controlView.xuanjiBgView.kanDianListArr = kanDianListArr
1228 - self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid) 1228 + self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid, isRefreshPlayer:true )
1229 self.player.allowOrentitaionRotation = true 1229 self.player.allowOrentitaionRotation = true
1230 }else{ 1230 }else{
1231 //没付费 1231 //没付费
@@ -1268,7 +1268,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa @@ -1268,7 +1268,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1268 // self.controlView.xuanjiBgView.currSeleIdx = seleIdx 1268 // self.controlView.xuanjiBgView.currSeleIdx = seleIdx
1269 // self.controlView.xuanjiBgView.kanDianListArr = kanDianListArr 1269 // self.controlView.xuanjiBgView.kanDianListArr = kanDianListArr
1270 // 1270 //
1271 -// self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid) 1271 +// self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid, isRefreshPlayer: )
1272 } 1272 }
1273 } 1273 }
1274 // MARK: - 简介cell点击事件 1274 // MARK: - 简介cell点击事件