Commit 528c245e11035ced7d9d0f25fa54df320e7d0932

Authored by “张旭”
1 parent 3a78176b

抽取公共方法---点击 专辑/看点

metaCode/Classes/Main/HuBiLieHomePage/Controller/CNLiveTVPlayerViewController.swift
... ... @@ -401,46 +401,61 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
401 401 // 将结果转换为字符串
402 402 yuanString = String(yuan)
403 403  
404   - if isPayZhuanJi{
405   - //已经付费
406   - self.controlView.payBgView.isHidden = true
407   - self.contentId = self.vodPlayModel?.contentId ?? ""
408   - self.albumListArr = albumListArr
409   - self.albumIndex = 0
410   - self.kanDianIndex = -1
411   - self.isPlayAblumOrKandian = true
412   - self.kanDianOrAlbumChangeContentApi(contentId: self.vodPlayModel?.contentId ?? "", title: title, isAlbum: true, activeId: self.vodPlayModel?.contentId ?? "", isRefreshPlayer: true)
413   - self.player.allowOrentitaionRotation = true
414   - }else{
415   - //没付费
416   - //显示付费页面
417   - let vodMdl = CNLiveVodPlayModel()
418   - vodMdl.product = self.vodPlayModel?.product
419   - vodMdl.contentId = self.vodPlayModel?.contentId ?? ""
420   - vodMdl.model = self.vodPlayModel?.model ?? ""
421   - self.controlView.vodPlayModel = vodMdl
422   - self.controlView.payBgView.isHidden = false
423   - self.controlView.payBgView.payBtn.setTitle("\(yuanString)元购买本专辑", for: .normal)
424   - //成功用pay参数 刷新页面
425   - self.albumListArr = NSMutableArray(array: self.vodAlbumListBaseModel?.list ?? [CNLiveVodAlbumListModel]())
426   - if self.albumListArr.count > 0{
427   - if let vodAlbumListModel = self.albumListArr[0] as? CNLiveVodAlbumListModel{
428   - self.payVodAlbumListModel = vodAlbumListModel
429   - self.payAid = vodAlbumListModel.albumId//.contentId
430   - self.payContentId = vodAlbumListModel.contentId
431   - self.payAlbumListArr = albumListArr
432   - self.payIndex = 0
433   - self.kanDianIndex = -1
434   - self.isPlayAblumOrKandian = true
435   - self.payTitle = title
436   - self.payIsAlbum = true
437   - self.payActivityId = vodAlbumListModel.activityId
438   - self.player.allowOrentitaionRotation = false
439   - }
  404 + //true当前播放的专辑 false看点
  405 +// let isAblumVideo = false// (model.album?.albumId.count ?? 0 > 0) ? true : false
  406 + let isAblumVideo = (self.vodPlayModel?.album?.albumId.count ?? 0 > 0) ? true : false
  407 + var vodAlbumListModel:CNLiveVodAlbumListModel?
  408 + if self.albumListArr.count > 0{
  409 + if let vodAlbumListMdl = self.albumListArr[0] as? CNLiveVodAlbumListModel{
  410 + vodAlbumListModel = vodAlbumListMdl
440 411 }
441   -
442 412 }
  413 + self.selectKanDianOrAlbum(isPayZhuanJi: isPayZhuanJi, mdlProduct: self.vodPlayModel?.product, mdlContentId: self.vodPlayModel?.contentId ?? "", isAblumVideo: isAblumVideo, albumSelectIndex: 0, albumListArray: albumListArr, kanDianSelectIndex: -1, kanDianListArray: NSMutableArray(), isPlayAblumOrKandian: isAblumVideo, xuanjiBgViewCurrSeleIdx: 0, xuanjiBgViewKanDianListArr: NSMutableArray(), modelTitle: title, mdlActiveId: self.vodPlayModel?.contentId ?? "", mdlModel: self.vodPlayModel?.model ?? "", yuanString: yuanString, payVodAlbumListModel: vodAlbumListModel, vodAlbumListBaseModel: self.vodAlbumListBaseModel)
443 414  
  415 +// if isPayZhuanJi{
  416 +// //已经付费
  417 +// self.controlView.payBgView.isHidden = true
  418 +// self.contentId = self.vodPlayModel?.contentId ?? ""
  419 +// self.albumListArr = albumListArr
  420 +// self.albumIndex = 0
  421 +// self.kanDianIndex = -1
  422 +// self.isPlayAblumOrKandian = true
  423 +// self.kanDianOrAlbumChangeContentApi(contentId: self.vodPlayModel?.contentId ?? "", title: title, isAlbum: true, activeId: self.vodPlayModel?.contentId ?? "", isRefreshPlayer: true)
  424 +// self.player.allowOrentitaionRotation = true
  425 +// }else{
  426 +// //没付费
  427 +// //显示付费页面
  428 +// let vodMdl = CNLiveVodPlayModel()
  429 +// vodMdl.product = self.vodPlayModel?.product
  430 +// vodMdl.contentId = self.vodPlayModel?.contentId ?? ""
  431 +// vodMdl.model = self.vodPlayModel?.model ?? ""
  432 +// self.controlView.vodPlayModel = vodMdl
  433 +// self.controlView.payBgView.isHidden = false
  434 +// self.controlView.payBgView.payBtn.setTitle("\(yuanString)元购买本专辑", for: .normal)
  435 +//
  436 +// //成功用pay参数 刷新页面
  437 +// self.albumListArr = NSMutableArray(array: self.vodAlbumListBaseModel?.list ?? [CNLiveVodAlbumListModel]())
  438 +// if self.albumListArr.count > 0{
  439 +// if let vodAlbumListModel = self.albumListArr[0] as? CNLiveVodAlbumListModel{
  440 +// self.payVodAlbumListModel = vodAlbumListModel
  441 +// self.payAid = vodAlbumListModel.albumId//.contentId
  442 +// self.payContentId = vodAlbumListModel.contentId
  443 +// self.payAlbumListArr = albumListArr
  444 +// self.payIndex = 0
  445 +// self.payTitle = title
  446 +// self.payIsAlbum = true
  447 +// self.payActivityId = vodAlbumListModel.activityId
  448 +// self.player.allowOrentitaionRotation = false
  449 +//
  450 +// self.contentId = self.vodPlayModel?.contentId ?? ""
  451 +// self.albumListArr = albumListArr
  452 +// self.albumIndex = 0
  453 +// self.kanDianIndex = -1
  454 +// self.isPlayAblumOrKandian = true
  455 +// self.kanDianOrAlbumChangeContentApi(contentId: self.vodPlayModel?.contentId ?? "", title: title, isAlbum: true, activeId: self.vodPlayModel?.contentId ?? "", isRefreshPlayer: false)
  456 +// }
  457 +// }
  458 +// }
444 459 }else{
445 460 //免费
446 461 self.controlView.payBgView.isHidden = true
... ... @@ -556,7 +571,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
556 571 if let albumModel = self.albumListArr[nextIdx] as? CNLiveVodAlbumListModel{
557 572 //播专辑列表下一条
558 573 self.contentId = albumModel.contentId
559   - self.kanDianOrAlbumChangeContentApi(contentId: albumModel.contentId, title: albumModel.title, isAlbum: self.isAblumVideo, activeId: albumModel.activityId, isRefreshPlayer: true)
  574 + self.kanDianOrAlbumChangeContentApi(contentId: albumModel.contentId, title: albumModel.title, isAlbum: true, activeId: albumModel.activityId, isRefreshPlayer: true)
560 575 // self.changeContentApi(vodModel: albumModel)
561 576 }
562 577  
... ... @@ -572,7 +587,9 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
572 587 self.albumIndex = -1
573 588 if let albumModel = self.kanDianListArr[nextIdx] as? CNLiveVodPlayBlockListListModel{
574 589 //播列表下一条
575   - let isAblumVideo = (albumModel.album?.albumId.count ?? 0 > 0) ? true : false
  590 + //true当前播放的专辑 false看点
  591 + let isAblumVideo = false// (model.album?.albumId.count ?? 0 > 0) ? true : false
  592 +// let isAblumVideo = (albumModel.album?.albumId.count ?? 0 > 0) ? true : false
576 593 // if isAblumVideo{
577 594 self.kanDianOrAlbumChangeContentApi(contentId: albumModel.contentId, title: albumModel.title, isAlbum: isAblumVideo, activeId: albumModel.pid, isRefreshPlayer: true)
578 595 // }else{
... ... @@ -727,8 +744,6 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
727 744  
728 745 // MARK: -专辑/看点 列表切换某集 ,刷新看点和电商
729 746 func changeContentApi(activityId:String,title:String,contentId:String,isRefreshPlayer:Bool){
730   -// self.isPlayAblumOrKandian = true
731   -
732 747 //play接口刷新 看点和电商 1350755
733 748 CNLiveDownSlideTool.getVodPlayApi(contentId: contentId) {[weak self] result, status in
734 749 guard let self = self else { return }
... ... @@ -915,52 +930,63 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
915 930 self.controlView.payBgView.isHidden = true
916 931 isPayZhuanJi = true
917 932 }
918   -
919   - if isPayZhuanJi{
920   - //已经付费
921   - self.controlView.payBgView.isHidden = true
922   -
923   - self.contentId = model.contentId
924   - let isAblumVideo = (model.album?.albumId.count ?? 0 > 0) ? true : false
925   - self.albumIndex = -1
926   - self.kanDianIndex = index
927   - self.kanDianListArr = kanDianListArr
928   - //只更新 此视频的长id,换url(不管是不是专辑)
929   - self.isPlayAblumOrKandian = false
930   - //更新选集-看点列表
931   - //kanDianListArr cnLivevodPlayBlocjListlistModel
932   - self.controlView.xuanjiBgView.currSeleIdx = index
933   - self.controlView.xuanjiBgView.kanDianListArr = kanDianListArr
934   - self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid, isRefreshPlayer:true )
935   - self.player.allowOrentitaionRotation = true
936   - }else{
937   - //没付费
938   - //显示付费页面
939   - let vodMdl = CNLiveVodPlayModel()
940   - vodMdl.product = model.product
941   - vodMdl.contentId = model.contentId
942   - vodMdl.model = model.model
943   - self.controlView.vodPlayModel = vodMdl
944   - self.controlView.payBgView.isHidden = false
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   -
954   - //成功用pay参数 刷新页面
955   - self.payVodProductModel = model.product
956   - self.payContentId = model.contentId
957   - self.payIndex = -1
958   - self.payTitle = model.title
959   - self.payIsAlbum = false
960   - self.payActivityId = model.pid
961   - self.player.allowOrentitaionRotation = false
962   - self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid, isRefreshPlayer:false )
  933 +
  934 + //true当前播放的专辑 false看点
  935 + let isAblumVideo = false// (model.album?.albumId.count ?? 0 > 0) ? true : false
  936 + var vodAlbumListModel:CNLiveVodAlbumListModel?
  937 + if self.albumListArr.count > 0{
  938 + if let vodAlbumListMdl = self.albumListArr[0] as? CNLiveVodAlbumListModel{
  939 + vodAlbumListModel = vodAlbumListMdl
  940 + }
963 941 }
  942 + self.selectKanDianOrAlbum(isPayZhuanJi: isPayZhuanJi, mdlProduct: model.product, mdlContentId: model.contentId, isAblumVideo: isAblumVideo, albumSelectIndex: -1, albumListArray: NSMutableArray(), kanDianSelectIndex: index, kanDianListArray: kanDianListArr, isPlayAblumOrKandian: isAblumVideo, xuanjiBgViewCurrSeleIdx: index, xuanjiBgViewKanDianListArr: kanDianListArr, modelTitle: model.title, mdlActiveId: model.pid, mdlModel: model.model, yuanString: yuanString, payVodAlbumListModel: vodAlbumListModel, vodAlbumListBaseModel: nil)
  943 +
  944 +
  945 +// if isPayZhuanJi{
  946 +// //已经付费
  947 +// self.controlView.payBgView.isHidden = true
  948 +//
  949 +// self.contentId = model.contentId
  950 +// let isAblumVideo = (model.album?.albumId.count ?? 0 > 0) ? true : false
  951 +// self.albumIndex = -1
  952 +// self.kanDianIndex = index
  953 +// self.kanDianListArr = kanDianListArr
  954 +// //只更新 此视频的长id,换url(不管是不是专辑)
  955 +// self.isPlayAblumOrKandian = false
  956 +// //更新选集-看点列表
  957 +// //kanDianListArr cnLivevodPlayBlocjListlistModel
  958 +// self.controlView.xuanjiBgView.currSeleIdx = index
  959 +// self.controlView.xuanjiBgView.kanDianListArr = kanDianListArr
  960 +// self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid, isRefreshPlayer:true )
  961 +// self.player.allowOrentitaionRotation = true
  962 +// }else{
  963 +// //没付费
  964 +// //显示付费页面
  965 +// let vodMdl = CNLiveVodPlayModel()
  966 +// vodMdl.product = model.product
  967 +// vodMdl.contentId = model.contentId
  968 +// vodMdl.model = model.model
  969 +// self.controlView.vodPlayModel = vodMdl
  970 +// self.controlView.payBgView.isHidden = false
  971 +// self.controlView.payBgView.payBtn.setTitle("\(yuanString)元购买本集内容", for: .normal)
  972 +//
  973 +// self.contentId = model.contentId
  974 +// let isAblumVideo = (model.album?.albumId.count ?? 0 > 0) ? true : false
  975 +// self.albumIndex = -1
  976 +// self.kanDianIndex = index
  977 +// self.kanDianListArr = kanDianListArr
  978 +// self.isPlayAblumOrKandian = false
  979 +//
  980 +// //成功用pay参数 刷新页面
  981 +// self.payVodProductModel = model.product
  982 +// self.payContentId = model.contentId
  983 +// self.payIndex = -1
  984 +// self.payTitle = model.title
  985 +// self.payIsAlbum = false
  986 +// self.payActivityId = model.pid
  987 +// self.player.allowOrentitaionRotation = false
  988 +// self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid, isRefreshPlayer:false )
  989 +// }
964 990 }
965 991 return cell
966 992 }else{
... ... @@ -986,12 +1012,11 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
986 1012 //CNLiveVodPlayblockListListModel
987 1013 }
988 1014 //点击专辑
989   - cell.selectBlock = {[weak self] vodModel, index ,albumListArr in
  1015 + cell.selectBlock = {[weak self] vodModel, index ,albumListArr,vodAlbumListBaseModel in
990 1016 guard let self = self else { return }
991 1017 self.player.currentPlayerManager.pause()
992 1018 isPayZhuanJi = false//是否付过费
993 1019 var yuanString = "1"
994   -
995 1020 let isPaid = CNLivePlayerTool.isPaid(product: vodModel.product)
996 1021 if isPaid{
997 1022 //需要付费
... ... @@ -1019,45 +1044,56 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1019 1044 isPayZhuanJi = true
1020 1045 }
1021 1046  
1022   - if isPayZhuanJi{
1023   - //已经付费
1024   - self.controlView.payBgView.isHidden = true
1025   - self.contentId = vodModel.contentId
1026   - self.albumListArr = albumListArr
1027   - self.albumIndex = index
1028   - self.kanDianIndex = -1
1029   - self.isPlayAblumOrKandian = true
1030   - self.kanDianOrAlbumChangeContentApi(contentId: vodModel.contentId, title: vodModel.title, isAlbum: true, activeId: vodModel.activityId, isRefreshPlayer: true)
1031   - self.player.allowOrentitaionRotation = true
1032   - }else{
1033   - //没付费
1034   - //显示付费页面
1035   - let vodMdl = CNLiveVodPlayModel()
1036   - vodMdl.product = vodModel.product
1037   - vodMdl.contentId = vodModel.contentId
1038   - vodMdl.model = vodModel.modelId
1039   - self.controlView.vodPlayModel = vodMdl
1040   - self.controlView.payBgView.isHidden = false
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   -
1049   - //成功用pay参数 刷新页面
1050   - self.payVodAlbumListModel = vodModel
1051   - self.payAid = vodModel.albumId//.contentId
1052   - self.payContentId = vodModel.contentId
1053   - self.payAlbumListArr = albumListArr
1054   - self.payIndex = index
1055   - self.payTitle = vodModel.title
1056   - self.payIsAlbum = true
1057   - self.payActivityId = vodModel.activityId
1058   - self.player.allowOrentitaionRotation = false
1059   - self.kanDianOrAlbumChangeContentApi(contentId: vodModel.contentId, title: vodModel.title, isAlbum: true, activeId: vodModel.activityId, isRefreshPlayer: false)
  1047 + //true当前播放的专辑 false看点
  1048 + let isAblumVideo = true// (model.album?.albumId.count ?? 0 > 0) ? true : false
  1049 +// let isAblumVideo = (vodModel.albumId.count > 0) ? true : false
  1050 + var vodAlbumListModel:CNLiveVodAlbumListModel?
  1051 + if self.albumListArr.count > 0{
  1052 + if let vodAlbumListMdl = self.albumListArr[0] as? CNLiveVodAlbumListModel{
  1053 + vodAlbumListModel = vodAlbumListMdl
  1054 + }
1060 1055 }
  1056 + self.selectKanDianOrAlbum(isPayZhuanJi: isPayZhuanJi, mdlProduct: vodModel.product, mdlContentId: vodModel.contentId, isAblumVideo: isAblumVideo, albumSelectIndex: index, albumListArray: albumListArr, kanDianSelectIndex: -1, kanDianListArray: NSMutableArray(), isPlayAblumOrKandian: isAblumVideo, xuanjiBgViewCurrSeleIdx: 0, xuanjiBgViewKanDianListArr: NSMutableArray(), modelTitle: vodModel.title, mdlActiveId: vodModel.contentId, mdlModel: vodModel.modelId, yuanString: yuanString, payVodAlbumListModel: vodAlbumListModel, vodAlbumListBaseModel: vodAlbumListBaseModel)
  1057 +
  1058 +// if isPayZhuanJi{
  1059 +// //已经付费
  1060 +// self.controlView.payBgView.isHidden = true
  1061 +// self.contentId = vodModel.contentId
  1062 +// self.albumListArr = albumListArr
  1063 +// self.albumIndex = index
  1064 +// self.kanDianIndex = -1
  1065 +// self.isPlayAblumOrKandian = true
  1066 +// self.kanDianOrAlbumChangeContentApi(contentId: vodModel.contentId, title: vodModel.title, isAlbum: true, activeId: vodModel.activityId, isRefreshPlayer: true)
  1067 +// self.player.allowOrentitaionRotation = true
  1068 +// }else{
  1069 +// //没付费
  1070 +// //显示付费页面
  1071 +// let vodMdl = CNLiveVodPlayModel()
  1072 +// vodMdl.product = vodModel.product
  1073 +// vodMdl.contentId = vodModel.contentId
  1074 +// vodMdl.model = vodModel.modelId
  1075 +// self.controlView.vodPlayModel = vodMdl
  1076 +// self.controlView.payBgView.isHidden = false
  1077 +// self.controlView.payBgView.payBtn.setTitle("\(yuanString)元购买本专辑", for: .normal)
  1078 +//
  1079 +// self.contentId = vodModel.contentId
  1080 +// self.albumListArr = albumListArr
  1081 +// self.albumIndex = index
  1082 +// self.kanDianIndex = -1
  1083 +// self.isPlayAblumOrKandian = true
  1084 +//
  1085 +// //成功用pay参数 刷新页面
  1086 +// self.payVodAlbumListModel = vodModel
  1087 +// self.payAid = vodModel.albumId//.contentId
  1088 +// self.payContentId = vodModel.contentId
  1089 +// self.payAlbumListArr = albumListArr
  1090 +// self.payIndex = index
  1091 +// self.payTitle = vodModel.title
  1092 +// self.payIsAlbum = true
  1093 +// self.payActivityId = vodModel.activityId
  1094 +// self.player.allowOrentitaionRotation = false
  1095 +// self.kanDianOrAlbumChangeContentApi(contentId: vodModel.contentId, title: vodModel.title, isAlbum: true, activeId: vodModel.activityId, isRefreshPlayer: false)
  1096 +// }
1061 1097 }
1062 1098 return cell
1063 1099 }else if let vodPlayShopModels = self.dataArray[indexPath.row] as? [CNLiveVodPlayShopModel]{
... ... @@ -1165,6 +1201,107 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1165 1201 }
1166 1202  
1167 1203 }
  1204 + // MARK: - 点击 看点/专辑
  1205 + //isAblumVideo true:播放或选择的专辑 false:看点
  1206 + func selectKanDianOrAlbum(isPayZhuanJi:Bool,mdlProduct:CNLiveAlbumProductModel?,mdlContentId:String,isAblumVideo:Bool,albumSelectIndex:Int,albumListArray:NSMutableArray,kanDianSelectIndex:Int,kanDianListArray: NSMutableArray,isPlayAblumOrKandian:Bool,xuanjiBgViewCurrSeleIdx:Int,xuanjiBgViewKanDianListArr:NSMutableArray,modelTitle:String,mdlActiveId:String,mdlModel:String,yuanString:String,payVodAlbumListModel:CNLiveVodAlbumListModel?,vodAlbumListBaseModel : CNLiveVodAlbumListBaseModel?){
  1207 +
  1208 + if isPayZhuanJi{
  1209 + //已付费
  1210 + if isAblumVideo{
  1211 + //点击专辑
  1212 + self.controlView.payBgView.isHidden = isPayZhuanJi
  1213 + self.contentId = mdlContentId
  1214 + self.albumListArr = albumListArray
  1215 + self.albumIndex = albumSelectIndex
  1216 + self.kanDianIndex = kanDianSelectIndex
  1217 + self.isPlayAblumOrKandian = isPlayAblumOrKandian
  1218 + //更新选集-专辑列表
  1219 + self.controlView.xuanjiBgView.currSeleIdx = xuanjiBgViewCurrSeleIdx
  1220 + self.controlView.xuanjiBgView.vodAlbumListBaseModel = vodAlbumListBaseModel
  1221 + self.kanDianOrAlbumChangeContentApi(contentId: mdlContentId, title: modelTitle, isAlbum: isAblumVideo, activeId: mdlActiveId, isRefreshPlayer: isPayZhuanJi)
  1222 + self.player.allowOrentitaionRotation = isPayZhuanJi
  1223 + }else{
  1224 + //点击看点
  1225 + self.controlView.payBgView.isHidden = isPayZhuanJi
  1226 + self.contentId = mdlContentId
  1227 + self.albumIndex = albumSelectIndex
  1228 + self.albumListArr = albumListArray
  1229 + self.kanDianIndex = kanDianSelectIndex
  1230 + self.kanDianListArr = kanDianListArray
  1231 + //只更新 此视频的长id,换url(不管是不是专辑)
  1232 + self.isPlayAblumOrKandian = isPlayAblumOrKandian
  1233 + //更新选集-看点列表
  1234 + self.controlView.xuanjiBgView.currSeleIdx = xuanjiBgViewCurrSeleIdx
  1235 + self.controlView.xuanjiBgView.kanDianListArr = kanDianListArray
  1236 + self.kanDianOrAlbumChangeContentApi(contentId: mdlContentId, title: modelTitle, isAlbum: isAblumVideo, activeId: mdlActiveId, isRefreshPlayer:isPayZhuanJi)
  1237 + self.player.allowOrentitaionRotation = isPayZhuanJi
  1238 + }
  1239 + }else{
  1240 + //未付费
  1241 + if isAblumVideo{
  1242 + //点击专辑
  1243 + //显示付费页面
  1244 + let vodMdl = CNLiveVodPlayModel()
  1245 + vodMdl.product = mdlProduct
  1246 + vodMdl.contentId = mdlContentId
  1247 + vodMdl.model = mdlModel
  1248 + self.controlView.vodPlayModel = vodMdl
  1249 + self.controlView.payBgView.isHidden = isPayZhuanJi
  1250 + self.controlView.payBgView.payBtn.setTitle("\(yuanString)元购买本专辑", for: .normal)
  1251 +
  1252 + self.contentId = mdlContentId
  1253 + self.albumListArr = albumListArray
  1254 + self.albumIndex = albumSelectIndex
  1255 + self.kanDianIndex = kanDianSelectIndex
  1256 + self.isPlayAblumOrKandian = isPlayAblumOrKandian
  1257 +
  1258 + //成功用pay参数 刷新页面
  1259 + self.payVodAlbumListModel = payVodAlbumListModel
  1260 + self.payAid = payVodAlbumListModel?.albumId ?? ""
  1261 + self.payContentId = payVodAlbumListModel?.contentId ?? ""
  1262 + self.payAlbumListArr = albumListArray
  1263 + self.payIndex = albumSelectIndex
  1264 + self.payTitle = modelTitle
  1265 + self.payIsAlbum = isAblumVideo
  1266 + self.payActivityId = mdlActiveId
  1267 + self.player.allowOrentitaionRotation = isPayZhuanJi
  1268 +
  1269 + //更新选集-专辑列表
  1270 + self.controlView.xuanjiBgView.currSeleIdx = xuanjiBgViewCurrSeleIdx
  1271 + self.controlView.xuanjiBgView.vodAlbumListBaseModel = vodAlbumListBaseModel
  1272 + self.kanDianOrAlbumChangeContentApi(contentId: mdlContentId, title: modelTitle, isAlbum: isAblumVideo, activeId: mdlActiveId, isRefreshPlayer: isPayZhuanJi)
  1273 + }else{
  1274 + //点击看点
  1275 + let vodMdl = CNLiveVodPlayModel()
  1276 + vodMdl.product = mdlProduct
  1277 + vodMdl.contentId = mdlContentId
  1278 + vodMdl.model = mdlModel
  1279 + self.controlView.vodPlayModel = vodMdl
  1280 + self.controlView.payBgView.isHidden = false
  1281 + self.controlView.payBgView.payBtn.setTitle("\(yuanString)元购买本集内容", for: .normal)
  1282 +
  1283 + self.contentId = mdlContentId
  1284 + self.albumIndex = albumSelectIndex
  1285 + self.kanDianIndex = kanDianSelectIndex
  1286 + self.kanDianListArr = kanDianListArray
  1287 + self.isPlayAblumOrKandian = isPlayAblumOrKandian
  1288 +
  1289 + //成功用pay参数 刷新页面
  1290 + self.payVodProductModel = mdlProduct
  1291 + self.payContentId = mdlContentId
  1292 + self.payIndex = albumSelectIndex
  1293 + self.payTitle = modelTitle
  1294 + self.payIsAlbum = isAblumVideo
  1295 + self.payActivityId = mdlActiveId
  1296 + self.player.allowOrentitaionRotation = isPayZhuanJi
  1297 + //更新选集-看点列表
  1298 + self.controlView.xuanjiBgView.currSeleIdx = xuanjiBgViewCurrSeleIdx
  1299 + self.controlView.xuanjiBgView.kanDianListArr = kanDianListArray
  1300 + self.kanDianOrAlbumChangeContentApi(contentId: mdlContentId, title: modelTitle, isAlbum: isAblumVideo, activeId: mdlActiveId, isRefreshPlayer:isPayZhuanJi)
  1301 + }
  1302 + }
  1303 + }
  1304 +
1168 1305 // MARK: - 看点cell展开
1169 1306 func trailersCellDetailBtnAction(vodPlayBlockListModel:CNLiveVodPlayBlockListModel) {
1170 1307 bottomCommentShowContainView.isHidden = false
... ... @@ -1209,46 +1346,61 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
1209 1346 self.controlView.payBgView.isHidden = true
1210 1347 isPayZhuanJi = true
1211 1348 }
1212   -
1213   - if isPayZhuanJi{
1214   - //已经付费
1215   - self.controlView.payBgView.isHidden = true
1216   -
1217   - self.contentId = model.contentId
1218   - let isAblumVideo = (model.album?.albumId.count ?? 0 > 0) ? true : false
1219   - self.albumIndex = -1
1220   - self.kanDianIndex = seleIdx
1221   - self.kanDianListArr = kanDianListArr
1222   - //只更新 此视频的长id,换url(不管是不是专辑)
1223   - self.isPlayAblumOrKandian = false
1224   - //更新选集-看点列表
1225   - //kanDianListArr cnLivevodPlayBlocjListlistModel
1226   - self.controlView.xuanjiBgView.currSeleIdx = seleIdx
1227   - self.controlView.xuanjiBgView.kanDianListArr = kanDianListArr
1228   - self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid, isRefreshPlayer:true )
1229   - self.player.allowOrentitaionRotation = true
1230   - }else{
1231   - //没付费
1232   - //显示付费页面
1233   - let vodMdl = CNLiveVodPlayModel()
1234   - vodMdl.product = model.product
1235   - vodMdl.contentId = model.contentId
1236   - vodMdl.model = model.model
1237   - self.controlView.vodPlayModel = vodMdl
1238   - self.controlView.payBgView.isHidden = false
1239   - self.controlView.payBgView.payBtn.setTitle("\(yuanString)元购买本集内容", for: .normal)
1240   - //成功用pay参数 刷新页面
1241   - self.payVodProductModel = model.product
1242   - self.payContentId = model.contentId
1243   - self.payIndex = -1
1244   - self.kanDianIndex = seleIdx
1245   - self.isPlayAblumOrKandian = false
1246   - self.payTitle = model.title
1247   - self.payIsAlbum = false
1248   - self.payActivityId = model.pid
1249   - self.player.allowOrentitaionRotation = false
  1349 +
  1350 +// let isAblumVideo = (model.album?.albumId.count ?? 0 > 0) ? true : false
  1351 +// self.selectKanDianOrAlbum(isPayZhuanJi: isPayZhuanJi, mdlProduct: model.product, mdlContentId: model.contentId, isAblumVideo: isAblumVideo, albumSelectIndex: -1, kanDianSelectIndex: seleIdx, kanDianListArray: kanDianListArr, isPlayAblumOrKandian: false, xuanjiBgViewCurrSeleIdx: seleIdx, xuanjiBgViewKanDianListArr: kanDianListArr, modelTitle: model.title, mdlActiveId: model.pid, mdlModel: model.model, yuanString: yuanString)
  1352 +
  1353 + //true当前播放的专辑 false看点
  1354 + let isAblumVideo = false// (model.album?.albumId.count ?? 0 > 0) ? true : false
  1355 +// let isAblumVideo = (model.album?.albumId.count ?? 0 > 0) ? true : false
  1356 + var vodAlbumListModel:CNLiveVodAlbumListModel?
  1357 + if self.albumListArr.count > 0{
  1358 + if let vodAlbumListMdl = self.albumListArr[0] as? CNLiveVodAlbumListModel{
  1359 + vodAlbumListModel = vodAlbumListMdl
  1360 + }
1250 1361 }
  1362 + self.selectKanDianOrAlbum(isPayZhuanJi: isPayZhuanJi, mdlProduct: model.product, mdlContentId: model.contentId, isAblumVideo: isAblumVideo, albumSelectIndex: -1, albumListArray: NSMutableArray(), kanDianSelectIndex: seleIdx, kanDianListArray: kanDianListArr, isPlayAblumOrKandian: isAblumVideo, xuanjiBgViewCurrSeleIdx: seleIdx, xuanjiBgViewKanDianListArr: kanDianListArr, modelTitle: model.title, mdlActiveId: model.pid, mdlModel: model.model, yuanString: yuanString, payVodAlbumListModel: vodAlbumListModel, vodAlbumListBaseModel: nil)
1251 1363  
  1364 +// if isPayZhuanJi{
  1365 +// //已经付费
  1366 +// self.controlView.payBgView.isHidden = true
  1367 +//
  1368 +// self.contentId = model.contentId
  1369 +// let isAblumVideo = (model.album?.albumId.count ?? 0 > 0) ? true : false
  1370 +// self.albumIndex = -1
  1371 +// self.kanDianIndex = seleIdx
  1372 +// self.kanDianListArr = kanDianListArr
  1373 +// //只更新 此视频的长id,换url(不管是不是专辑)
  1374 +// self.isPlayAblumOrKandian = false
  1375 +// //更新选集-看点列表
  1376 +// //kanDianListArr cnLivevodPlayBlocjListlistModel
  1377 +// self.controlView.xuanjiBgView.currSeleIdx = seleIdx
  1378 +// self.controlView.xuanjiBgView.kanDianListArr = kanDianListArr
  1379 +// self.kanDianOrAlbumChangeContentApi(contentId: model.contentId, title: model.title, isAlbum: isAblumVideo, activeId: model.pid, isRefreshPlayer:true )
  1380 +// self.player.allowOrentitaionRotation = true
  1381 +// }else{
  1382 +// //没付费
  1383 +// //显示付费页面
  1384 +// let vodMdl = CNLiveVodPlayModel()
  1385 +// vodMdl.product = model.product
  1386 +// vodMdl.contentId = model.contentId
  1387 +// vodMdl.model = model.model
  1388 +// self.controlView.vodPlayModel = vodMdl
  1389 +// self.controlView.payBgView.isHidden = false
  1390 +// self.controlView.payBgView.payBtn.setTitle("\(yuanString)元购买本集内容", for: .normal)
  1391 +// //成功用pay参数 刷新页面
  1392 +// self.payVodProductModel = model.product
  1393 +// self.payContentId = model.contentId
  1394 +// self.payIndex = -1
  1395 +// self.kanDianIndex = seleIdx
  1396 +// self.isPlayAblumOrKandian = false
  1397 +// self.payTitle = model.title
  1398 +// self.payIsAlbum = false
  1399 +// self.payActivityId = model.pid
  1400 +// self.player.allowOrentitaionRotation = false
  1401 +// }
  1402 +
  1403 +
1252 1404  
1253 1405  
1254 1406 // self.contentId = model.contentId
... ...
metaCode/Classes/Main/HuBiLieHomePage/View/VodDetail/CNLiveVodAlbumListCell.swift
... ... @@ -7,7 +7,7 @@
7 7  
8 8 import Foundation
9 9  
10   -typealias CNLiveVodAlbumListCellSelectBlock = (_ vodModel:CNLiveVodAlbumListModel,_ index:Int,_ albumListModels:NSMutableArray)->Void;
  10 +typealias CNLiveVodAlbumListCellSelectBlock = (_ vodModel:CNLiveVodAlbumListModel,_ index:Int,_ albumListModels:NSMutableArray,_ vodAlbumListBaseModel:CNLiveVodAlbumListBaseModel?)->Void;
11 11  
12 12 class CNLiveVodAlbumListCell:UITableViewCell, UICollectionViewDelegate, UICollectionViewDataSource{
13 13 var currSeleIdx:Int = 0
... ... @@ -91,7 +91,7 @@ class CNLiveVodAlbumListCell:UITableViewCell, UICollectionViewDelegate, UICollec
91 91 func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
92 92 if let vodAlbumListModel = self.albumListArr[indexPath.row] as? CNLiveVodAlbumListModel{
93 93 //点击某集,刷新页面
94   - self.selectBlock?(vodAlbumListModel, indexPath.row, self.albumListArr)
  94 + self.selectBlock?(vodAlbumListModel, indexPath.row, self.albumListArr, self.vodAlbumListBaseModel)
95 95 self.currSeleIdx = indexPath.row
96 96 self.realHotCollectionView.reloadData()
97 97  
... ...
metaCode/Classes/Main/HuBiLieHomePage/View/VodDetail/HengPing/CNLiveVodLandscapeXuanjiView.swift
... ... @@ -66,15 +66,11 @@ class CNLiveVodLandscapeXuanjiView:UIView, UITableViewDataSource, UITableViewDel
66 66 _vodAlbumListBaseModel
67 67 }
68 68 set{
69   - _vodAlbumListBaseModel = newValue!
70   - self.setupNewUI(model: vodAlbumListBaseModel!)
  69 + _vodAlbumListBaseModel = newValue
  70 + self.setupNewUI(model: vodAlbumListBaseModel)
71 71 }
72 72 }
73 73  
74   -// lazy var kanDianListArr :NSMutableArray = {
75   -// let kanDianListArr = NSMutableArray()
76   -// return kanDianListArr
77   -// }()
78 74 var _kanDianListArr : NSMutableArray?
79 75 var kanDianListArr : NSMutableArray? {
80 76 get{
... ... @@ -214,7 +210,7 @@ class CNLiveVodLandscapeXuanjiView:UIView, UITableViewDataSource, UITableViewDel
214 210 }
215 211  
216 212 //专辑列表
217   - func setupNewUI(model:CNLiveVodAlbumListBaseModel){
  213 + func setupNewUI(model:CNLiveVodAlbumListBaseModel?){
218 214 // self.albumListArr = NSMutableArray(array: model.list)
219 215 // self.realHotCollectionView.reloadData()
220 216  
... ... @@ -236,8 +232,8 @@ class CNLiveVodLandscapeXuanjiView:UIView, UITableViewDataSource, UITableViewDel
236 232 var hangIndex = 1
237 233  
238 234 var maxContentHeight:CGFloat = self.bgScrollView.height
239   - for i in 0..<model.list.count{
240   - let listMdl = model.list[i]
  235 + for i in 0..<(model?.list.count ?? 0){
  236 + let listMdl = model?.list[i]
241 237 let rowH = WH+padding
242 238 let imgX = CGFloat(lieIndex)*(WH+padding)
243 239 let imgY = rowH*CGFloat(hangIndex-1)
... ... @@ -277,7 +273,7 @@ class CNLiveVodLandscapeXuanjiView:UIView, UITableViewDataSource, UITableViewDel
277 273 layerView.frame = CGRect(x: 0, y: 0, width: 26, height: 15)
278 274 expandBtn.addSubview(layerView)
279 275  
280   - let isPaid = CNLivePlayerTool.isPaid(product: listMdl.product)
  276 + let isPaid = CNLivePlayerTool.isPaid(product: listMdl?.product)
281 277 if isPaid{
282 278 layerView.isHidden = false
283 279 }else{
... ...