Commit d84f6c89100764d317f11ebd216ff20cafcec52b

Authored by “张旭”
1 parent 4de43f91

更改付费判断 , 优化首页

metaCode/Classes/Main/HomePage/Controller/DownSlideController/CNUpSlideViewController.swift
... ... @@ -25,7 +25,7 @@ let SlideModelTypeLanmu22: String = "22"//22首页栏目 电影 电视剧 纪录
25 25 let SlideModelTypeFollow77: String = "77"//正在追 接口type77
26 26 let SlideModelTypeTVOneBigTwoSmall2: String = "2"//2 一大图两小图
27 27 let SlideModelTypeAD31: String = "31"//31横幅广告
28   -let SlideModelTypeTwoDuanJu5: String = "5"//5竖版短剧 一排两个
  28 +let SlideModelTypeTwoDuanJu5: String = "5"//5忽必烈版5一排三个 ,旧版5竖版短剧 一排两个
29 29 let SlideModelTypeOngHangThree3: String = "3"//3竖版 一排三个
30 30  
31 31 let SlideModelTypeShop29: String = "29"//29 官方周边
... ...
metaCode/Classes/Main/HomePages/Model/CNLiveAlbumModel.swift
... ... @@ -33,6 +33,7 @@ class CNLiveAlbumModel:BaseModel{
33 33 var title = ""
34 34 var subTitle = ""
35 35 var poster = ""
  36 + var verticalImg = ""//1行3个竖图
36 37 var contentId = ""
37 38 var pid = ""
38 39 var tag = ""
... ...
metaCode/Classes/Main/HuBiLieHomePage/Controller/CNLiveHomeMoreController.swift
... ... @@ -349,8 +349,15 @@ class CNLiveHomeMoreController:CNLiveBaseViewController, UITableViewDataSource,
349 349  
350 350 self.tableView.mj_header?.endRefreshing()
351 351  
352   - //分成3个一组
353   - let chunkedArray = self.chunkArray(array: self.dataArray as! Array<Any>, chunkSize: 3)
  352 + //分成2/3个一组
  353 + var chunkSize:Int = 2
  354 + if self.slideModel?.type == SlideModelTypeTwoDuanJu5{//1排3个竖屏
  355 + chunkSize = 3
  356 + }else if self.slideModel?.type == SlideModelTypeTVOneBigTwoSmall2{//1排2个横屏
  357 + chunkSize = 2
  358 + }
  359 +
  360 + let chunkedArray = self.chunkArray(array: self.dataArray as! Array<Any>, chunkSize: chunkSize)
354 361 self.dataArray = NSMutableArray(array: chunkedArray)
355 362 self.tableView.reloadData()
356 363 if albumBaseModel.hasNextPage{
... ...
metaCode/Classes/Main/HuBiLieHomePage/Controller/CNLiveTVPlayerViewController.swift
... ... @@ -350,53 +350,31 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
350 350  
351 351 }
352 352  
353   - if self.vodPlayModel?.product?.check == true {
354   - //免费或者付过费了
355   - self.controlView.payBgView.isHidden = true
356   - isPayZhuanJi = true
357   -
  353 + if self.vodPlayModel?.product?.productType == "2" || self.vodPlayModel?.product?.productType == "5"{//付费
  354 + var yuanString = ""
  355 + //需要付费
  356 + self.controlView.payBgView.isHidden = false
  357 + isPayZhuanJi = false
358 358 var urls = [URL]()
359 359 urls.append(self.url!)
360 360 self.player.assetURLs = urls
361 361 self.player.playTheIndex(0)
362   -
363   - } else {
364   - var yuanString = ""
365   - if self.vodPlayModel?.product?.productType == "4" {
366   - //这里表示可以进行试听
367   - self.controlView.payBgView.isHidden = true
368   - isPayZhuanJi = true
369   - var urls = [URL]()
370   - urls.append(self.url!)
371   - self.player.assetURLs = urls
372   - self.player.playTheIndex(0)
373   -
374   - } else {
375   - //需要付费
376   - self.controlView.payBgView.isHidden = false
377   - isPayZhuanJi = false
378   - var urls = [URL]()
379   - urls.append(self.url!)
380   - self.player.assetURLs = urls
381   - self.player.playTheIndex(0)
382   - self.player.currentPlayerManager.pause()
383   - //分转元,没有小数点
384   - let fenString = self.vodPlayModel!.product!.iosRmb
385   - // 将字符串转换为整数
386   - // 使用guard语句确保字符串可以转换为整数
387   - guard let fen = Int(fenString) else {
388   - print("无法将字符串转换为整数")
389   - return
390   - }
391   - // 计算元值(整数除法,自动舍去小数部分)
392   - var yuan = fen / 100
393   - if yuan <= 0{//如果是测试0.1元 ,线上默认设置为1元
394   - yuan = 1
395   - }
396   - // 将结果转换为字符串
397   - yuanString = String(yuan)
398   -
  362 + self.player.currentPlayerManager.pause()
  363 + //分转元,没有小数点
  364 + let fenString = self.vodPlayModel!.product!.iosRmb
  365 + // 将字符串转换为整数
  366 + // 使用guard语句确保字符串可以转换为整数
  367 + guard let fen = Int(fenString) else {
  368 + print("无法将字符串转换为整数")
  369 + return
399 370 }
  371 + // 计算元值(整数除法,自动舍去小数部分)
  372 + var yuan = fen / 100
  373 + if yuan <= 0{//如果是测试0.1元 ,线上默认设置为1元
  374 + yuan = 1
  375 + }
  376 + // 将结果转换为字符串
  377 + yuanString = String(yuan)
400 378  
401 379 var title = ""
402 380 if let blockListModel = self.vodPlayModel?.blockList.first as? CNLiveVodPlayBlockListModel{
... ... @@ -404,7 +382,7 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
404 382 title = blockListListModel.title
405 383 }
406 384 }
407   -
  385 +
408 386 if isPayZhuanJi{
409 387 //已经付费
410 388 self.controlView.payBgView.isHidden = true
... ... @@ -444,7 +422,35 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
444 422 }
445 423  
446 424 }
447   -
  425 + }else{
  426 + if self.vodPlayModel?.product?.check == true {
  427 + //免费或者付过费了
  428 + self.controlView.payBgView.isHidden = true
  429 + isPayZhuanJi = true
  430 +
  431 + var urls = [URL]()
  432 + urls.append(self.url!)
  433 + self.player.assetURLs = urls
  434 + self.player.playTheIndex(0)
  435 +
  436 + } else {
  437 + if self.vodPlayModel?.product?.productType == "4" {
  438 + //这里表示可以进行试听
  439 + self.controlView.payBgView.isHidden = true
  440 + isPayZhuanJi = true
  441 + var urls = [URL]()
  442 + urls.append(self.url!)
  443 + self.player.assetURLs = urls
  444 + self.player.playTheIndex(0)
  445 + }else{
  446 + self.controlView.payBgView.isHidden = true
  447 + isPayZhuanJi = true
  448 + var urls = [URL]()
  449 + urls.append(self.url!)
  450 + self.player.assetURLs = urls
  451 + self.player.playTheIndex(0)
  452 + }
  453 + }
448 454 }
449 455  
450 456  
... ... @@ -916,34 +922,40 @@ class CNLiveTVPlayerViewController:UIViewController, UITableViewDataSource, UITa
916 922 self.player.currentPlayerManager.pause()
917 923 isPayZhuanJi = false//是否付过费
918 924 var yuanString = "1"
919   - if vodModel.product?.check == true {
920   - //免费或者付过费了
921   - self.controlView.payBgView.isHidden = true
922   - isPayZhuanJi = true
923   - } else {
924   - if vodModel.product?.productType == "4" {
925   - //这里表示可以进行试听
  925 + if vodModel.product?.productType == "2" || vodModel.product?.productType == "5"{//付费
  926 + //需要付费
  927 + self.controlView.payBgView.isHidden = false
  928 + isPayZhuanJi = false
  929 + //分转元,没有小数点
  930 + let fenString = vodModel.product!.iosRmb
  931 + // 将字符串转换为整数
  932 + // 使用guard语句确保字符串可以转换为整数
  933 + guard let fen = Int(fenString) else {
  934 + print("无法将字符串转换为整数")
  935 + return
  936 + }
  937 + // 计算元值(整数除法,自动舍去小数部分)
  938 + var yuan = fen / 100
  939 + if yuan <= 0{//如果是测试0.1元 ,线上默认设置为1元
  940 + yuan = 1
  941 + }
  942 + // 将结果转换为字符串
  943 + yuanString = String(yuan)
  944 +
  945 + }else{
  946 + if vodModel.product?.check == true {
  947 + //免费或者付过费了
926 948 self.controlView.payBgView.isHidden = true
927 949 isPayZhuanJi = true
928 950 } else {
929   - //需要付费
930   - self.controlView.payBgView.isHidden = false
931   - isPayZhuanJi = false
932   - //分转元,没有小数点
933   - let fenString = vodModel.product!.iosRmb
934   - // 将字符串转换为整数
935   - // 使用guard语句确保字符串可以转换为整数
936   - guard let fen = Int(fenString) else {
937   - print("无法将字符串转换为整数")
938   - return
939   - }
940   - // 计算元值(整数除法,自动舍去小数部分)
941   - var yuan = fen / 100
942   - if yuan <= 0{//如果是测试0.1元 ,线上默认设置为1元
943   - yuan = 1
  951 + if vodModel.product?.productType == "4" {
  952 + //这里表示可以进行试听
  953 + self.controlView.payBgView.isHidden = true
  954 + isPayZhuanJi = true
  955 + } else {
  956 + self.controlView.payBgView.isHidden = true
  957 + isPayZhuanJi = true
944 958 }
945   - // 将结果转换为字符串
946   - yuanString = String(yuan)
947 959 }
948 960 }
949 961  
... ...
metaCode/Classes/Main/HuBiLieHomePage/View/Home/Home/CNLiveHomeADCell.swift
... ... @@ -5,14 +5,118 @@
5 5 // Created by zx on 2025/2/20.
6 6 //
7 7  
  8 +//import Foundation
  9 +
  10 +//class CNLiveHomeADCell: UITableViewCell {
  11 +// //slideModel
  12 +// var _slideModel : CNLiveDownSlideModel?
  13 +// var slideModel : CNLiveDownSlideModel? {
  14 +// get{
  15 +// _slideModel
  16 +// }
  17 +// set{
  18 +// _slideModel = newValue!
  19 +//
  20 +// for obj in contentView.subviews{
  21 +// obj.removeFromSuperview()
  22 +// }
  23 +// self.setupNewUI(model: _slideModel!)
  24 +// }
  25 +// }
  26 +// override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  27 +// super.init(style: style, reuseIdentifier: reuseIdentifier)
  28 +// self.selectionStyle = .none
  29 +// contentView.backgroundColor = .white
  30 +// contentView.clipsToBounds = true
  31 +// }
  32 +//
  33 +// required init?(coder: NSCoder) {
  34 +// fatalError("init(coder:) has not been implemented")
  35 +// }
  36 +//
  37 +// func setupNewUI(model:CNLiveDownSlideModel){
  38 +// //总块数
  39 +// let contentsNum = model.contents.count
  40 +// //model行数
  41 +// let row = model.rowNum
  42 +// //总显示块数
  43 +// var totalNum = (contentsNum >= row) ? row : contentsNum
  44 +// if row == 0{//row为0 , contents全部显示
  45 +// totalNum = contentsNum
  46 +// }
  47 +// for i in 0..<totalNum{//i是第几行
  48 +// let contentMdl = model.contents[i]
  49 +// let imageView = UIImageView(frame: CGRectMake(DownSlideRecommendLeftGap, CGFloat(i)*(DownSlideTodayRecommendH+DownSlideRecommendLeftGap), CGFloat(DownSlideTodayRecommendW), CGFloat(CNLiveHomeADH)))
  50 +// imageView.kf.setImage(with: URL(string:contentMdl.poster ))
  51 +// imageView.tag = i
  52 +// imageView.contentMode = .scaleAspectFill
  53 +// imageView.layer.cornerRadius = 9
  54 +// imageView.clipsToBounds = true
  55 +// imageView.isUserInteractionEnabled = true
  56 +// imageView.addGestureRecognizer(UITapGestureRecognizer.init(target: self, action: #selector(pushWebAction)))
  57 +// contentView.addSubview(imageView)
  58 +// }
  59 +// }
  60 +//
  61 +// @objc func pushWebAction(ges: UITapGestureRecognizer){
  62 +// let imageView = ges.view as! UIImageView
  63 +// let i = imageView.tag
  64 +// if let bannerMdl = self.slideModel?.contents[i]{
  65 +// CNLiveDownSlideTool.pushWebAndVodVCWithContentsMdl(model: bannerMdl.model, contentId: bannerMdl.contentId, pid: bannerMdl.pid, shareUrl: bannerMdl.shareUrl, thirdUrl: bannerMdl.thirdUrl, title: bannerMdl.title, s_to: bannerMdl.s_to, trailerId: bannerMdl.trailerId, controller: navigationViewController().visibleViewController, slideModel: nil)
  66 +//
  67 +// }
  68 +//
  69 +// }
  70 +//}
  71 +
8 72 import Foundation
  73 +import FSPagerView
9 74  
10 75 ///今日推荐高度
11 76 let CNLiveHomeADH: CGFloat = CNLiveHomeADW*90/345
12 77 ///今日推荐宽度
13 78 let CNLiveHomeADW: CGFloat = KSreenWidth-DownSlideRecommendLeftGap*2
14 79  
15   -class CNLiveHomeADCell: UITableViewCell {
  80 +class CNLiveHomeADCell: UITableViewCell ,FSPagerViewDataSource,FSPagerViewDelegate{
  81 +
  82 + let kCNLliveShopDetailBannerCellID = "kCNLliveShopDetailBannerCellID"
  83 + lazy var viewPager: FSPagerView = {
  84 + let viewPager = FSPagerView()
  85 + viewPager.frame = CGRect(x: 15, y: 0, width: KSreenWidth-30, height: 190.0*(KSreenWidth-30)/345.0)
  86 + viewPager.dataSource = self
  87 + viewPager.delegate = self
  88 + viewPager.register(FSPagerViewCell.self, forCellWithReuseIdentifier: kCNLliveShopDetailBannerCellID)
  89 + //设置自动翻页事件间隔,默认值为0 (不自动翻页)
  90 + viewPager.automaticSlidingInterval = 3
  91 + //设置页面之间的间隔距离
  92 + viewPager.interitemSpacing = 8.0
  93 + //设置可以无限翻页,默认值为false,false时从尾部向前滚动到头部再继续循环滚动,true时可以无限滚动
  94 + viewPager.isInfinite = true
  95 + //设置转场的模式
  96 + viewPager.transformer = FSPagerViewTransformer(type: FSPagerViewTransformerType.linear)
  97 + viewPager.layer.cornerRadius = 9
  98 + viewPager.clipsToBounds = true
  99 +
  100 + return viewPager
  101 + }()
  102 +
  103 + // 懒加载滚动图片浏下标
  104 + lazy var pagerControl:FSPageControl = {
  105 + let pageControl = FSPageControl(frame: CGRect(x: KSreenWidth-30-100, y: 190.0*(KSreenWidth-30)/345.0-14, width: 100, height: 4))
  106 + //设置下标位置
  107 + pageControl.contentHorizontalAlignment = .right
  108 + //设置下标指示器颜色(选中状态和普通状态)
  109 + pageControl.setFillColor(HexColor("#FFFFFF"), for: .normal)
  110 + pageControl.setFillColor(HexColor("#2076FF"), for: .selected)
  111 +
  112 + //绘制下标指示器的形状 (roundedRect绘制绘制圆角或者圆形)
  113 + pageControl.setPath(UIBezierPath.init(roundedRect: CGRect.init(x: 0, y: 0, width: 8, height: 4),cornerRadius: 2.0), for: .selected)
  114 + pageControl.setPath(UIBezierPath(ovalIn: CGRect(x: 0, y: 0, width: 4, height: 4)), for: .normal)
  115 + return pageControl
  116 +
  117 + }()
  118 +
  119 +
16 120 //slideModel
17 121 var _slideModel : CNLiveDownSlideModel?
18 122 var slideModel : CNLiveDownSlideModel? {
... ... @@ -21,11 +125,13 @@ class CNLiveHomeADCell: UITableViewCell {
21 125 }
22 126 set{
23 127 _slideModel = newValue!
24   -
25   - for obj in contentView.subviews{
26   - obj.removeFromSuperview()
  128 + //设置下标的个数
  129 + self.pagerControl.numberOfPages = (_slideModel?.contents.count)!
  130 + if _slideModel?.contents.count == 1 {
  131 + self.viewPager.isInfinite = false
27 132 }
28   - self.setupNewUI(model: _slideModel!)
  133 + self.viewPager.reloadData()
  134 +
29 135 }
30 136 }
31 137 override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
... ... @@ -33,43 +139,73 @@ class CNLiveHomeADCell: UITableViewCell {
33 139 self.selectionStyle = .none
34 140 contentView.backgroundColor = .white
35 141 contentView.clipsToBounds = true
  142 +
  143 + self.contentView.addSubview(self.viewPager)
  144 + self.contentView.addSubview(self.pagerControl)
36 145 }
37 146  
38 147 required init?(coder: NSCoder) {
39 148 fatalError("init(coder:) has not been implemented")
40 149 }
41   -
42   - func setupNewUI(model:CNLiveDownSlideModel){
43   - //总块数
44   - let contentsNum = model.contents.count
45   - //model行数
46   - let row = model.rowNum
47   - //总显示块数
48   - var totalNum = (contentsNum >= row) ? row : contentsNum
49   - if row == 0{//row为0 , contents全部显示
50   - totalNum = contentsNum
51   - }
52   - for i in 0..<totalNum{//i是第几行
53   - let contentMdl = model.contents[i]
54   - let imageView = UIImageView(frame: CGRectMake(DownSlideRecommendLeftGap, CGFloat(i)*(DownSlideTodayRecommendH+DownSlideRecommendLeftGap), CGFloat(DownSlideTodayRecommendW), CGFloat(CNLiveHomeADH)))
55   - imageView.kf.setImage(with: URL(string:contentMdl.poster ))
56   - imageView.tag = i
57   - imageView.contentMode = .scaleAspectFill
58   - imageView.layer.cornerRadius = 9
59   - imageView.clipsToBounds = true
60   - imageView.isUserInteractionEnabled = true
61   - imageView.addGestureRecognizer(UITapGestureRecognizer.init(target: self, action: #selector(pushWebAction)))
62   - contentView.addSubview(imageView)
  150 +
  151 + // MARK: - FSPagerViewDataSource
  152 + func numberOfItems(in pagerView: FSPagerView) -> Int {
  153 + return (self.slideModel?.contents.count)!
  154 + }
  155 + func pagerView(_ pagerView: FSPagerView, cellForItemAt index: Int) -> FSPagerViewCell {
  156 + let cell = pagerView.dequeueReusableCell(withReuseIdentifier: kCNLliveShopDetailBannerCellID, at: index)
  157 + if self.slideModel?.contents.count ?? 0 >= (index+1){
  158 + let imgUrl = self.slideModel?.contents[index].poster
  159 + cell.imageView?.kf.setImage(with: URL(string: imgUrl!))
  160 + cell.textLabel?.text = self.slideModel?.contents[index].title
  161 +
63 162 }
  163 + cell.imageView?.layer.cornerRadius = 9
  164 + cell.imageView?.clipsToBounds = true
  165 + cell.textLabel?.font = BoldFont_18
  166 + return cell
64 167 }
65 168  
66   - @objc func pushWebAction(ges: UITapGestureRecognizer){
67   - let imageView = ges.view as! UIImageView
68   - let i = imageView.tag
69   - if let bannerMdl = self.slideModel?.contents[i]{
70   - CNLiveDownSlideTool.pushWebAndVodVCWithContentsMdl(model: bannerMdl.model, contentId: bannerMdl.contentId, pid: bannerMdl.pid, shareUrl: bannerMdl.shareUrl, thirdUrl: bannerMdl.thirdUrl, title: bannerMdl.title, s_to: bannerMdl.s_to, trailerId: bannerMdl.trailerId, controller: navigationViewController().visibleViewController, slideModel: nil)
  169 + func pagerView(_ pagerView: FSPagerView, willDisplay cell: FSPagerViewCell, forItemAt index: Int) {
  170 + self.pagerControl.currentPage = index
71 171  
  172 + }
  173 +
  174 + func pagerView(_ pagerView: FSPagerView, didSelectItemAt index: Int) {
  175 + if index >= (self.slideModel?.contents.count ?? 0){
  176 + return
72 177 }
73   -
  178 + if let bannerMdl = self.slideModel?.contents[index]{
  179 + CNLiveDownSlideTool.pushWebAndVodVCWithContentsMdl(model: bannerMdl.model, contentId: bannerMdl.contentId, pid: bannerMdl.pid, shareUrl: bannerMdl.shareUrl, thirdUrl: bannerMdl.thirdUrl, title: bannerMdl.title, s_to: bannerMdl.s_to, trailerId: bannerMdl.trailerId, controller: navigationViewController().visibleViewController, slideModel: nil)
  180 + }
  181 +// if bannerMdl?.model == "1" || bannerMdl?.model == "album_video"{
  182 +// //点播页面
  183 +// let vc = CNLiveTVPlayerViewController()
  184 +// let url = result as! String
  185 +// vc.url = URL(string: url)
  186 +// vc.contentsModel = bannerMdl
  187 +// navigationViewController().pushViewController(vc, animated: pushAnimated)
  188 +//
  189 +// }else if bannerMdl?.model == "product"{
  190 +// //电商h5
  191 +// let webVC = CNWebViewController()
  192 +// // webVC.url = URL(string: "https://managemall.cnlive.com/html/mall/1/#/pages/main/shopIndex/shop?shop_id=313") 电商测试支付url
  193 +// guard let url = URL(string: bannerMdl?.thirdUrl ?? "") else {
  194 +// return
  195 +// }
  196 +// webVC.url = url
  197 +// navigationViewController().pushViewController(webVC, animated: pushAnimated)
  198 +// }else{
  199 +// //h5
  200 +// let webVC = CNWebViewController()
  201 +// // webVC.url = URL(string: "https://managemall.cnlive.com/html/mall/1/#/pages/main/shopIndex/shop?shop_id=313") 电商测试支付url
  202 +// guard let url = URL(string: bannerMdl?.thirdUrl ?? "") else {
  203 +// return
  204 +// }
  205 +// webVC.url = url
  206 +// navigationViewController().pushViewController(webVC, animated: pushAnimated)
  207 +//
  208 +// }
74 209 }
  210 +
75 211 }
... ...
metaCode/Classes/Main/HuBiLieHomePage/View/Home/Home/CNLiveHomeOneBigTwoSmallCell.swift
... ... @@ -390,34 +390,19 @@ class CNLiveHomeOneBigTwoSmallCell:UITableViewCell{
390 390 payIconView.image = UIImage(named: "home_player_pay")
391 391 payIconView.frame = CGRect(x: 0, y: 0, width: 26, height: 15)
392 392 imageView.addSubview(payIconView)
393   -
394   - if contMdl.product?.check == true {
395   - //免费或者付过费了
396   - payIconView.isHidden = true
397   - } else {
398   - if contMdl.product?.productType == "4" {
399   - //这里表示可以进行试听
  393 + if contMdl.product?.productType == "2" || contMdl.product?.productType == "5"{//付费
  394 + payIconView.isHidden = false
  395 + }else{
  396 + if contMdl.product?.check == true {
  397 + //免费或者付过费了
400 398 payIconView.isHidden = true
401 399 } else {
402   - //需要付费
403   - payIconView.isHidden = false
404   -
405   - //分转元,没有小数点
406   - let fenString = contMdl.product!.iosRmb
407   - // 将字符串转换为整数
408   - // 使用guard语句确保字符串可以转换为整数
409   - guard let fen = Int(fenString) else {
410   - print("无法将字符串转换为整数")
411   - return
412   - }
413   - // 计算元值(整数除法,自动舍去小数部分)
414   - var yuan = fen / 100
415   - if yuan <= 0{//如果是测试0.1元 ,线上默认设置为1元
416   - yuan = 1
  400 + if contMdl.product?.productType == "4" {
  401 + //这里表示可以进行试听
  402 + payIconView.isHidden = true
  403 + } else {
  404 + payIconView.isHidden = true
417 405 }
418   - // 将结果转换为字符串
419   - let yuanString = String(yuan)
420   -
421 406 }
422 407 }
423 408  
... ...
metaCode/Classes/Main/HuBiLieHomePage/View/Home/Home/CNLiveHomeTwoDuanjuCell.swift
... ... @@ -96,7 +96,7 @@ class CNLiveHomeTwoDuanjuCell:UITableViewCell{
96 96  
97 97 let contMdl = model.contents[i]
98 98 let imageView = UIImageView(frame: CGRectMake(imgX, imgY, CGFloat(imgW), CGFloat(imgH)))
99   - imageView.kf.setImage(with: URL(string:contMdl.poster) ,placeholder: UIImage(color: .lightGray, size: imageView.size))
  99 + imageView.kf.setImage(with: URL(string:contMdl.verticalImg.count > 0 ? contMdl.verticalImg : contMdl.poster) ,placeholder: UIImage(color: .lightGray, size: imageView.size))
100 100 imageView.tag = 1000+i
101 101 imageView.layer.cornerRadius = 9
102 102 imageView.clipsToBounds = true
... ... @@ -111,33 +111,19 @@ class CNLiveHomeTwoDuanjuCell:UITableViewCell{
111 111 payIconView.frame = CGRect(x: 0, y: 0, width: 26, height: 15)
112 112 imageView.addSubview(payIconView)
113 113  
114   - if contMdl.product?.check == true {
115   - //免费或者付过费了
116   - payIconView.isHidden = true
117   - } else {
118   - if contMdl.product?.productType == "4" {
119   - //这里表示可以进行试听
  114 + if contMdl.product?.productType == "2" || contMdl.product?.productType == "5"{//付费
  115 + payIconView.isHidden = false
  116 + }else{
  117 + if contMdl.product?.check == true {
  118 + //免费或者付过费了
120 119 payIconView.isHidden = true
121 120 } else {
122   - //需要付费
123   - payIconView.isHidden = false
124   -
125   - //分转元,没有小数点
126   - let fenString = contMdl.product!.iosRmb
127   - // 将字符串转换为整数
128   - // 使用guard语句确保字符串可以转换为整数
129   - guard let fen = Int(fenString) else {
130   - print("无法将字符串转换为整数")
131   - return
132   - }
133   - // 计算元值(整数除法,自动舍去小数部分)
134   - var yuan = fen / 100
135   - if yuan <= 0{//如果是测试0.1元 ,线上默认设置为1元
136   - yuan = 1
  121 + if contMdl.product?.productType == "4" {
  122 + //这里表示可以进行试听
  123 + payIconView.isHidden = true
  124 + } else {
  125 + payIconView.isHidden = true
137 126 }
138   - // 将结果转换为字符串
139   - let yuanString = String(yuan)
140   -
141 127 }
142 128 }
143 129  
... ...
metaCode/Classes/Main/HuBiLieHomePage/View/Home/Home/CNLiveHomeTwoHengTuCell.swift
... ... @@ -88,36 +88,6 @@ class CNLiveHomeTwoHengTuCell: UITableViewCell {
88 88 payIconView.frame = CGRect(x: 0, y: 0, width: 26, height: 15)
89 89 imageView.addSubview(payIconView)
90 90  
91   -// if mdl.product?.check == true {
92   -// //免费或者付过费了
93   -// payIconView.isHidden = true
94   -// } else {
95   -// if mdl.product?.productType == "4" {
96   -// //这里表示可以进行试听
97   -// payIconView.isHidden = true
98   -// } else {
99   -// //需要付费
100   -// payIconView.isHidden = false
101   -//
102   -// //分转元,没有小数点
103   -// let fenString = mdl.product!.iosRmb
104   -// // 将字符串转换为整数
105   -// // 使用guard语句确保字符串可以转换为整数
106   -// guard let fen = Int(fenString) else {
107   -// print("无法将字符串转换为整数")
108   -// return
109   -// }
110   -// // 计算元值(整数除法,自动舍去小数部分)
111   -// var yuan = fen / 100
112   -// if yuan <= 0{//如果是测试0.1元 ,线上默认设置为1元
113   -// yuan = 1
114   -// }
115   -// // 将结果转换为字符串
116   -// let yuanString = String(yuan)
117   -//
118   -// }
119   -// }
120   -
121 91 let grayBgView = UIView(frame: CGRect(x: imageView.left, y: imageView.bottom, width: imageView.width, height: grayH))
122 92 grayBgView.backgroundColor = HexColor("#FAFAFA")
123 93 grayBgView.addCorner(conrners:[.bottomLeft,.bottomRight], radius: 9)
... ... @@ -163,33 +133,19 @@ class CNLiveHomeTwoHengTuCell: UITableViewCell {
163 133 payIconView.frame = CGRect(x: 0, y: 0, width: 26, height: 15)
164 134 imageView.addSubview(payIconView)
165 135  
166   - if mdl.product?.check == true {
167   - //免费或者付过费了
168   - payIconView.isHidden = true
169   - } else {
170   - if mdl.product?.productType == "4" {
171   - //这里表示可以进行试听
  136 + if mdl.product?.productType == "2" || mdl.product?.productType == "5"{//付费
  137 + payIconView.isHidden = false
  138 + }else{
  139 + if mdl.product?.check == true {
  140 + //免费或者付过费了
172 141 payIconView.isHidden = true
173 142 } else {
174   - //需要付费
175   - payIconView.isHidden = false
176   -
177   - //分转元,没有小数点
178   - let fenString = mdl.product!.iosRmb
179   - // 将字符串转换为整数
180   - // 使用guard语句确保字符串可以转换为整数
181   - guard let fen = Int(fenString) else {
182   - print("无法将字符串转换为整数")
183   - return
184   - }
185   - // 计算元值(整数除法,自动舍去小数部分)
186   - var yuan = fen / 100
187   - if yuan <= 0{//如果是测试0.1元 ,线上默认设置为1元
188   - yuan = 1
  143 + if mdl.product?.productType == "4" {
  144 + //这里表示可以进行试听
  145 + payIconView.isHidden = true
  146 + } else {
  147 + payIconView.isHidden = true
189 148 }
190   - // 将结果转换为字符串
191   - let yuanString = String(yuan)
192   -
193 149 }
194 150 }
195 151  
... ... @@ -237,33 +193,19 @@ class CNLiveHomeTwoHengTuCell: UITableViewCell {
237 193 payIconView.frame = CGRect(x: 0, y: 0, width: 26, height: 15)
238 194 imageView.addSubview(payIconView)
239 195  
240   - if mdl.product?.check == true {
241   - //免费或者付过费了
242   - payIconView.isHidden = true
243   - } else {
244   - if mdl.product?.productType == "4" {
245   - //这里表示可以进行试听
  196 + if mdl.product?.productType == "2" || mdl.product?.productType == "5"{//付费
  197 + payIconView.isHidden = false
  198 + }else{
  199 + if mdl.product?.check == true {
  200 + //免费或者付过费了
246 201 payIconView.isHidden = true
247 202 } else {
248   - //需要付费
249   - payIconView.isHidden = false
250   -
251   - //分转元,没有小数点
252   - let fenString = mdl.product!.iosRmb
253   - // 将字符串转换为整数
254   - // 使用guard语句确保字符串可以转换为整数
255   - guard let fen = Int(fenString) else {
256   - print("无法将字符串转换为整数")
257   - return
258   - }
259   - // 计算元值(整数除法,自动舍去小数部分)
260   - var yuan = fen / 100
261   - if yuan <= 0{//如果是测试0.1元 ,线上默认设置为1元
262   - yuan = 1
  203 + if mdl.product?.productType == "4" {
  204 + //这里表示可以进行试听
  205 + payIconView.isHidden = true
  206 + } else {
  207 + payIconView.isHidden = true
263 208 }
264   - // 将结果转换为字符串
265   - let yuanString = String(yuan)
266   -
267 209 }
268 210 }
269 211  
... ...
metaCode/Classes/Main/HuBiLieHomePage/View/Home/Lanmu/CNLiveHomeLanmuThreeImgCell.swift
... ... @@ -42,7 +42,7 @@ class CNLiveHomeLanmuThreeImgCell: UITableViewCell {
42 42 let x:CGFloat = leftPadding+(imgW+15.0)*CGFloat(idx)
43 43 let y:CGFloat = 10.0
44 44 let imageView = UIImageView(frame: CGRectMake(x, y, imgW, imgH))
45   - imageView.kf.setImage(with: URL(string:mdl.poster))
  45 + imageView.kf.setImage(with: URL(string:mdl.verticalImg.count > 0 ? mdl.verticalImg : mdl.poster))
46 46 imageView.tag = idx
47 47 imageView.layer.cornerRadius = 9
48 48 imageView.clipsToBounds = true
... ... @@ -62,33 +62,19 @@ class CNLiveHomeLanmuThreeImgCell: UITableViewCell {
62 62 payIconView.frame = CGRect(x: 0, y: 0, width: 26, height: 15)
63 63 imageView.addSubview(payIconView)
64 64  
65   - if mdl.product?.check == true {
66   - //免费或者付过费了
67   - payIconView.isHidden = true
68   - } else {
69   - if mdl.product?.productType == "4" {
70   - //这里表示可以进行试听
  65 + if mdl.product?.productType == "2" || mdl.product?.productType == "5"{//付费
  66 + payIconView.isHidden = false
  67 + }else{
  68 + if mdl.product?.check == true {
  69 + //免费或者付过费了
71 70 payIconView.isHidden = true
72 71 } else {
73   - //需要付费
74   - payIconView.isHidden = false
75   -
76   - //分转元,没有小数点
77   - let fenString = mdl.product!.iosRmb
78   - // 将字符串转换为整数
79   - // 使用guard语句确保字符串可以转换为整数
80   - guard let fen = Int(fenString) else {
81   - print("无法将字符串转换为整数")
82   - return
  72 + if mdl.product?.productType == "4" {
  73 + //这里表示可以进行试听
  74 + payIconView.isHidden = true
  75 + } else {
  76 + payIconView.isHidden = true
83 77 }
84   - // 计算元值(整数除法,自动舍去小数部分)
85   - var yuan = fen / 100
86   - if yuan <= 0{//如果是测试0.1元 ,线上默认设置为1元
87   - yuan = 1
88   - }
89   - // 将结果转换为字符串
90   - let yuanString = String(yuan)
91   -
92 78 }
93 79 }
94 80  
... ...
metaCode/Classes/Main/HuBiLieHomePage/View/Home/Search/CNLiveHomeSearchResultJuJiCell.swift
... ... @@ -97,34 +97,19 @@ class CNLiveHomeSearchResultJuJiCell: UITableViewCell {
97 97 }else{
98 98  
99 99 }
100   -
101   - if model.product?.check == true {
102   - //免费或者付过费了
103   - self.payIconView.isHidden = true
104   - } else {
105   - if model.product?.productType == "4" {
106   - //这里表示可以进行试听
  100 + if model.product?.productType == "2" || model.product?.productType == "5"{//付费
  101 + payIconView.isHidden = false
  102 + }else{
  103 + if model.product?.check == true {
  104 + //免费或者付过费了
107 105 self.payIconView.isHidden = true
108 106 } else {
109   - //需要付费
110   - self.payIconView.isHidden = false
111   -
112   - //分转元,没有小数点
113   - let fenString = model.product!.iosRmb
114   - // 将字符串转换为整数
115   - // 使用guard语句确保字符串可以转换为整数
116   - guard let fen = Int(fenString) else {
117   - print("无法将字符串转换为整数")
118   - return
119   - }
120   - // 计算元值(整数除法,自动舍去小数部分)
121   - var yuan = fen / 100
122   - if yuan <= 0{//如果是测试0.1元 ,线上默认设置为1元
123   - yuan = 1
  107 + if model.product?.productType == "4" {
  108 + //这里表示可以进行试听
  109 + self.payIconView.isHidden = true
  110 + } else {
  111 + self.payIconView.isHidden = true
124 112 }
125   - // 将结果转换为字符串
126   - let yuanString = String(yuan)
127   -
128 113 }
129 114 }
130 115  
... ...
metaCode/Classes/Main/HuBiLieHomePage/View/VodDetail/CNLiveVodAlbumListCollectionCell.swift
... ... @@ -62,33 +62,19 @@ class CNLiveVodAlbumListCollectionCell: UICollectionViewCell {
62 62 }
63 63  
64 64 func setupNewUI(model:CNLiveVodAlbumListModel){
65   - if model.product?.check == true {
66   - //免费或者付过费了
67   - self.payIconView.isHidden = true
68   - } else {
69   - if model.product?.productType == "4" {
70   - //这里表示可以进行试听
  65 + if model.product?.productType == "2" || model.product?.productType == "5"{//付费
  66 + payIconView.isHidden = false
  67 + }else{
  68 + if model.product?.check == true {
  69 + //免费或者付过费了
71 70 self.payIconView.isHidden = true
72 71 } else {
73   - //需要付费
74   - self.payIconView.isHidden = false
75   -
76   - //分转元,没有小数点
77   - let fenString = model.product!.iosRmb
78   - // 将字符串转换为整数
79   - // 使用guard语句确保字符串可以转换为整数
80   - guard let fen = Int(fenString) else {
81   - print("无法将字符串转换为整数")
82   - return
83   - }
84   - // 计算元值(整数除法,自动舍去小数部分)
85   - var yuan = fen / 100
86   - if yuan <= 0{//如果是测试0.1元 ,线上默认设置为1元
87   - yuan = 1
  72 + if model.product?.productType == "4" {
  73 + //这里表示可以进行试听
  74 + self.payIconView.isHidden = true
  75 + } else {
  76 + self.payIconView.isHidden = true
88 77 }
89   - // 将结果转换为字符串
90   - let yuanString = String(yuan)
91   -
92 78 }
93 79 }
94 80  
... ...
metaCode/Classes/Main/HuBiLieHomePage/View/VodDetail/CNLiveVodTrailerExpandCell.swift
... ... @@ -99,33 +99,19 @@ class CNLiveVodTrailerExpandCell:UITableViewCell{
99 99 self.subTitleLabel.text = model.subTitle
100 100 self.iconImgView.kf.setImage(with: URL(string: model.img))
101 101  
102   - if model.product?.check == true {
103   - //免费或者付过费了
104   - self.payIconView.isHidden = true
105   - } else {
106   - if model.product?.productType == "4" {
107   - //这里表示可以进行试听
  102 + if model.product?.productType == "2" || model.product?.productType == "5"{//付费
  103 + payIconView.isHidden = false
  104 + }else{
  105 + if model.product?.check == true {
  106 + //免费或者付过费了
108 107 self.payIconView.isHidden = true
109 108 } else {
110   - //需要付费
111   - self.payIconView.isHidden = false
112   -
113   - //分转元,没有小数点
114   - let fenString = model.product!.iosRmb
115   - // 将字符串转换为整数
116   - // 使用guard语句确保字符串可以转换为整数
117   - guard let fen = Int(fenString) else {
118   - print("无法将字符串转换为整数")
119   - return
120   - }
121   - // 计算元值(整数除法,自动舍去小数部分)
122   - var yuan = fen / 100
123   - if yuan <= 0{//如果是测试0.1元 ,线上默认设置为1元
124   - yuan = 1
  109 + if model.product?.productType == "4" {
  110 + //这里表示可以进行试听
  111 + self.payIconView.isHidden = true
  112 + } else {
  113 + self.payIconView.isHidden = true
125 114 }
126   - // 将结果转换为字符串
127   - let yuanString = String(yuan)
128   -
129 115 }
130 116 }
131 117  
... ...
metaCode/Classes/Main/HuBiLieHomePage/View/VodDetail/HengPing/CNLiveVodLandscapeXuanjiView.swift
... ... @@ -276,34 +276,19 @@ class CNLiveVodLandscapeXuanjiView:UIView, UITableViewDataSource, UITableViewDel
276 276 layerView.image = UIImage(named: "home_player_pay")
277 277 layerView.frame = CGRect(x: 0, y: 0, width: 26, height: 15)
278 278 expandBtn.addSubview(layerView)
279   -
280   - if listMdl.product?.check == true {
281   - //免费或者付过费了
282   - layerView.isHidden = true
283   - } else {
284   - if listMdl.product?.productType == "4" {
285   - //这里表示可以进行试听
  279 + if listMdl.product?.productType == "2" || listMdl.product?.productType == "5"{//付费
  280 + layerView.isHidden = false
  281 + }else{
  282 + if listMdl.product?.check == true {
  283 + //免费或者付过费了
286 284 layerView.isHidden = true
287 285 } else {
288   - //需要付费
289   - layerView.isHidden = false
290   -
291   - //分转元,没有小数点
292   - let fenString = listMdl.product!.iosRmb
293   - // 将字符串转换为整数
294   - // 使用guard语句确保字符串可以转换为整数
295   - guard let fen = Int(fenString) else {
296   - print("无法将字符串转换为整数")
297   - return
298   - }
299   - // 计算元值(整数除法,自动舍去小数部分)
300   - var yuan = fen / 100
301   - if yuan <= 0{//如果是测试0.1元 ,线上默认设置为1元
302   - yuan = 1
  286 + if listMdl.product?.productType == "4" {
  287 + //这里表示可以进行试听
  288 + layerView.isHidden = true
  289 + } else {
  290 + layerView.isHidden = true
303 291 }
304   - // 将结果转换为字符串
305   - let yuanString = String(yuan)
306   -
307 292 }
308 293 }
309 294  
... ...
metaCode/Classes/Main/HuBiLieHomePage/View/VodDetail/HengPing/CNLiveVodXuanjiKandianCell.swift
... ... @@ -129,33 +129,19 @@ class CNLiveVodXuanjiKandianCell:UITableViewCell{
129 129 self.totalBtn.backgroundColor = HexColor("#000000", alpha: 0.5)
130 130  
131 131 }
132   - if model.product?.check == true {
133   - //免费或者付过费了
134   - payIconView.isHidden = true
135   - } else {
136   - if model.product?.productType == "4" {
137   - //这里表示可以进行试听
  132 + if model.product?.productType == "2" || model.product?.productType == "5"{//付费
  133 + payIconView.isHidden = false
  134 + }else{
  135 + if model.product?.check == true {
  136 + //免费或者付过费了
138 137 payIconView.isHidden = true
139 138 } else {
140   - //需要付费
141   - payIconView.isHidden = false
142   -
143   - //分转元,没有小数点
144   - let fenString = model.product!.iosRmb
145   - // 将字符串转换为整数
146   - // 使用guard语句确保字符串可以转换为整数
147   - guard let fen = Int(fenString) else {
148   - print("无法将字符串转换为整数")
149   - return
150   - }
151   - // 计算元值(整数除法,自动舍去小数部分)
152   - var yuan = fen / 100
153   - if yuan <= 0{//如果是测试0.1元 ,线上默认设置为1元
154   - yuan = 1
  139 + if model.product?.productType == "4" {
  140 + //这里表示可以进行试听
  141 + payIconView.isHidden = true
  142 + } else {
  143 + payIconView.isHidden = true
155 144 }
156   - // 将结果转换为字符串
157   - let yuanString = String(yuan)
158   -
159 145 }
160 146 }
161 147  
... ...
metaCode/Classes/Main/Model/CNLiveDownSlideModel.swift
... ... @@ -66,6 +66,8 @@ class CNLiveDownSlideContentsModel: BaseModel {
66 66 var subTitle: String = ""
67 67 ///头像/
68 68 var poster: String = ""
  69 + //一排3个小竖图
  70 + var verticalImg:String = ""
69 71 ///videoId
70 72 var pid: String = ""
71 73 ///model
... ...
metaCode/Classes/Main/VideoPage/View/CNLiveShortVideoListTableViewCell.swift
... ... @@ -226,37 +226,41 @@ class CNLiveShortVideoListTableViewCell: UITableViewCell {
226 226  
227 227 let tipV: UIImageView = payView.viewWithTag(1001) as! UIImageView
228 228  
229   - if model.product?.check == true {
230   - //免费或者付过费了
231   - hiddenView(isHidden: false)
232   - } else {
233   - if model.product?.productType == "4" {
234   - //这里表示可以进行试听
  229 + if model.product?.productType == "2" || model.product?.productType == "5"{//付费
  230 + //需要付费
  231 + hiddenView(isHidden: true)
  232 +
  233 + //分转元,没有小数点
  234 + let fenString = model.product!.iosRmb
  235 + // 将字符串转换为整数
  236 + // 使用guard语句确保字符串可以转换为整数
  237 + guard let fen = Int(fenString) else {
  238 + print("无法将字符串转换为整数")
  239 + return
  240 + }
  241 + // 计算元值(整数除法,自动舍去小数部分)
  242 + var yuan = fen / 100
  243 + if yuan <= 0{//如果是测试0.1元 ,线上默认设置为1元
  244 + yuan = 1
  245 + }
  246 + // 将结果转换为字符串
  247 + let yuanString = String(yuan)
  248 +
  249 +
  250 + payButton.setTitle("\(yuanString)元解锁", for: .normal)
  251 + tipV.isHidden = false
  252 + tipV.image = UIImage(named: "short_video_pay")
  253 + }else{
  254 + if model.product?.check == true {
  255 + //免费或者付过费了
235 256 hiddenView(isHidden: false)
236 257 } else {
237   - //需要付费
238   - hiddenView(isHidden: true)
239   -
240   - //分转元,没有小数点
241   - let fenString = model.product!.iosRmb
242   - // 将字符串转换为整数
243   - // 使用guard语句确保字符串可以转换为整数
244   - guard let fen = Int(fenString) else {
245   - print("无法将字符串转换为整数")
246   - return
247   - }
248   - // 计算元值(整数除法,自动舍去小数部分)
249   - var yuan = fen / 100
250   - if yuan <= 0{//如果是测试0.1元 ,线上默认设置为1元
251   - yuan = 1
  258 + if model.product?.productType == "4" {
  259 + //这里表示可以进行试听
  260 + hiddenView(isHidden: false)
  261 + } else {
  262 + hiddenView(isHidden: false)
252 263 }
253   - // 将结果转换为字符串
254   - let yuanString = String(yuan)
255   -
256   -
257   - payButton.setTitle("\(yuanString)元解锁", for: .normal)
258   - tipV.isHidden = false
259   - tipV.image = UIImage(named: "short_video_pay")
260 264 }
261 265 }
262 266 }
... ...