Commit ddddcbe5384e67b6d6c75edd5637731952b46191

Authored by liushiyu
1 parent 10e85a73

付费逻辑

metaCode/Classes/Common/Util/CNLiveCommonQiniuTool.swift
@@ -94,11 +94,15 @@ class UploadManager: NSObject { @@ -94,11 +94,15 @@ class UploadManager: NSObject {
94 param.setValue("POST", forKey: "verb") 94 param.setValue("POST", forKey: "verb")
95 param.setValue("2", forKey: "storageType") 95 param.setValue("2", forKey: "storageType")
96 param.setValue(kBucketName_QN, forKey: "bucket") 96 param.setValue(kBucketName_QN, forKey: "bucket")
  97 + let custom_param = NSMutableDictionary()
  98 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  99 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
  100 + CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
97 CNLiveNetworking.setupShowResult(true) 101 CNLiveNetworking.setupShowResult(true)
98 CNLiveNetworking.setAllowRequestDefaultArgument(true) 102 CNLiveNetworking.setAllowRequestDefaultArgument(true)
99 CNLiveNetworking.setupShowDataResult(false) 103 CNLiveNetworking.setupShowDataResult(false)
100 CNLiveNetworking.setupSignRequestKey(APPKey)//APPKey_wjj APPKey 104 CNLiveNetworking.setupSignRequestKey(APPKey)//APPKey_wjj APPKey
101 - 105 +
102 CNLiveNetworking.requestNetwork(with: .POST, urlString: "\(CNLiveEnvironmentManager.shared.img_token_url)/vod_epg/getUploadAuthForApp", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in 106 CNLiveNetworking.requestNetwork(with: .POST, urlString: "\(CNLiveEnvironmentManager.shared.img_token_url)/vod_epg/getUploadAuthForApp", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
103 hiddenLoading() 107 hiddenLoading()
104 108
metaCode/Classes/Main/VideoPage/View/CNLiveShortVideoContentListView.swift
@@ -181,6 +181,16 @@ class CNLiveShortVideoContentListTableViewCell: UITableViewCell { @@ -181,6 +181,16 @@ class CNLiveShortVideoContentListTableViewCell: UITableViewCell {
181 return imageView 181 return imageView
182 }() 182 }()
183 183
  184 + lazy var tipView: UIImageView = {
  185 + let imageView = UIImageView.init()
  186 + imageView.contentMode = .scaleAspectFill
  187 + imageView.layer.cornerRadius = 5
  188 + imageView.layer.masksToBounds = true
  189 + imageView.clipsToBounds = true
  190 + imageView.isHidden = true
  191 + return imageView
  192 + }()
  193 +
184 lazy var titleLabel: UILabel = { 194 lazy var titleLabel: UILabel = {
185 let titleLabel = UILabel.init() 195 let titleLabel = UILabel.init()
186 titleLabel.textColor = .white 196 titleLabel.textColor = .white
@@ -210,6 +220,12 @@ class CNLiveShortVideoContentListTableViewCell: UITableViewCell { @@ -210,6 +220,12 @@ class CNLiveShortVideoContentListTableViewCell: UITableViewCell {
210 make.width.equalTo(50) 220 make.width.equalTo(50)
211 make.height.equalTo(70) 221 make.height.equalTo(70)
212 } 222 }
  223 + contentView.addSubview(tipView)
  224 + tipView.snp.makeConstraints { make in
  225 + make.left.top.equalToSuperview().offset(20)
  226 + make.width.equalTo(50)
  227 + make.height.equalTo(10)
  228 + }
213 contentView.addSubview(titleLabel) 229 contentView.addSubview(titleLabel)
214 titleLabel.snp.makeConstraints { make in 230 titleLabel.snp.makeConstraints { make in
215 make.left.equalTo(iconView.snp.right).offset(10) 231 make.left.equalTo(iconView.snp.right).offset(10)
@@ -231,6 +247,18 @@ class CNLiveShortVideoContentListTableViewCell: UITableViewCell { @@ -231,6 +247,18 @@ class CNLiveShortVideoContentListTableViewCell: UITableViewCell {
231 paragraphStyle.lineSpacing = 6 247 paragraphStyle.lineSpacing = 6
232 titleLabel.attributedText = NSAttributedString(string: listModel.title, attributes: [NSAttributedString.Key.paragraphStyle: paragraphStyle, ]) 248 titleLabel.attributedText = NSAttributedString(string: listModel.title, attributes: [NSAttributedString.Key.paragraphStyle: paragraphStyle, ])
233 timeLabel.text = listModel.duration 249 timeLabel.text = listModel.duration
  250 +
  251 + if listModel.product?.check == true {
  252 + if listModel.product?.albumProductType != "0" {
  253 + tipView.isHidden = false
  254 + tipView.image = UIImage(named: "short_video_free")
  255 + }
  256 + } else {
  257 + if listModel.product?.albumProductType != "0" {
  258 + tipView.isHidden = false
  259 + tipView.image = UIImage(named: "short_video_pay")
  260 + }
  261 + }
234 } 262 }
235 263
236 required init?(coder: NSCoder) { 264 required init?(coder: NSCoder) {
metaCode/Classes/Main/VideoPage/View/CNLiveShortVideoListTableViewCell.swift
@@ -189,36 +189,35 @@ class CNLiveShortVideoListTableViewCell: UITableViewCell { @@ -189,36 +189,35 @@ class CNLiveShortVideoListTableViewCell: UITableViewCell {
189 faviBtn.isHidden = model.albumMsgModel!.collection 189 faviBtn.isHidden = model.albumMsgModel!.collection
190 listBtn.setTitle(model.albumMsgModel?.albumName, for: .normal) 190 listBtn.setTitle(model.albumMsgModel?.albumName, for: .normal)
191 191
192 -  
193 -  
194 -  
195 -  
196 -  
197 -  
198 let imageV: UIImageView = payView.viewWithTag(1000) as! UIImageView 192 let imageV: UIImageView = payView.viewWithTag(1000) as! UIImageView
199 imageV.kf.indicatorType = .activity 193 imageV.kf.indicatorType = .activity
200 imageV.kf.setImage(with: URL(string: model.poster)) 194 imageV.kf.setImage(with: URL(string: model.poster))
201 - let titleL: UILabel = payView.viewWithTag(1001) as! UILabel 195 + let titleL: UILabel = payView.viewWithTag(1002) as! UILabel
202 titleL.text = model.title 196 titleL.text = model.title
203 - let timeL: UILabel = payView.viewWithTag(1002) as! UILabel 197 + let timeL: UILabel = payView.viewWithTag(1003) as! UILabel
204 timeL.text = model.duration 198 timeL.text = model.duration
205 - let payButton: APButton = payView.viewWithTag(1003) as! APButton 199 + let payButton: APButton = payView.viewWithTag(1004) as! APButton
206 200
  201 + let tipV: UIImageView = payView.viewWithTag(1001) as! UIImageView
207 if model.product?.check == true { 202 if model.product?.check == true {
208 //免费 203 //免费
209 if model.product?.albumProductType == "0" { 204 if model.product?.albumProductType == "0" {
210 - hiddenView(isHidden: true)  
211 - } else {  
212 hiddenView(isHidden: false) 205 hiddenView(isHidden: false)
  206 + } else {
  207 + hiddenView(isHidden: true)
213 payButton.setTitle("\(model.product!.point)积分解锁全集", for: .normal) 208 payButton.setTitle("\(model.product!.point)积分解锁全集", for: .normal)
  209 + tipV.isHidden = false
  210 + tipV.image = UIImage(named: "short_video_free")
214 } 211 }
215 } else { 212 } else {
216 //需要付费 213 //需要付费
217 if model.product?.albumProductType == "0" { 214 if model.product?.albumProductType == "0" {
218 - hiddenView(isHidden: true)  
219 - } else {  
220 hiddenView(isHidden: false) 215 hiddenView(isHidden: false)
  216 + } else {
  217 + hiddenView(isHidden: true)
221 payButton.setTitle("\(model.product!.point)积分解锁全集", for: .normal) 218 payButton.setTitle("\(model.product!.point)积分解锁全集", for: .normal)
  219 + tipV.isHidden = false
  220 + tipV.image = UIImage(named: "short_video_pay")
222 } 221 }
223 } 222 }
224 } 223 }
@@ -380,11 +379,25 @@ extension CNLiveShortVideoListTableViewCell { @@ -380,11 +379,25 @@ extension CNLiveShortVideoListTableViewCell {
380 make.height.equalTo(70) 379 make.height.equalTo(70)
381 } 380 }
382 381
  382 + let tipView = UIImageView.init()
  383 + tipView.contentMode = .scaleAspectFill
  384 + tipView.isHidden = true
  385 + tipView.layer.cornerRadius = 5
  386 + tipView.layer.masksToBounds = true
  387 + tipView.clipsToBounds = true
  388 + tipView.tag = 1001
  389 + view.addSubview(tipView)
  390 + tipView.snp.makeConstraints { make in
  391 + make.left.top.equalToSuperview().offset(20)
  392 + make.width.equalTo(50)
  393 + make.height.equalTo(10)
  394 + }
  395 +
383 let titleLabel = UILabel.init() 396 let titleLabel = UILabel.init()
384 titleLabel.textColor = .white 397 titleLabel.textColor = .white
385 titleLabel.lineBreakMode = .byTruncatingTail 398 titleLabel.lineBreakMode = .byTruncatingTail
386 titleLabel.numberOfLines = 2 399 titleLabel.numberOfLines = 2
387 - titleLabel.tag = 1001 400 + titleLabel.tag = 1002
388 titleLabel.font = medium_adapt_font(pointSize: 12) 401 titleLabel.font = medium_adapt_font(pointSize: 12)
389 view.addSubview(titleLabel) 402 view.addSubview(titleLabel)
390 titleLabel.snp.makeConstraints { make in 403 titleLabel.snp.makeConstraints { make in
@@ -395,7 +408,7 @@ extension CNLiveShortVideoListTableViewCell { @@ -395,7 +408,7 @@ extension CNLiveShortVideoListTableViewCell {
395 408
396 let timeLabel = UILabel.init() 409 let timeLabel = UILabel.init()
397 timeLabel.textColor = .white 410 timeLabel.textColor = .white
398 - timeLabel.tag = 1002 411 + timeLabel.tag = 1003
399 timeLabel.font = light_adapt_font(pointSize: 13) 412 timeLabel.font = light_adapt_font(pointSize: 13)
400 view.addSubview(timeLabel) 413 view.addSubview(timeLabel)
401 timeLabel.snp.makeConstraints { make in 414 timeLabel.snp.makeConstraints { make in
@@ -419,7 +432,7 @@ extension CNLiveShortVideoListTableViewCell { @@ -419,7 +432,7 @@ extension CNLiveShortVideoListTableViewCell {
419 payButton.layer.cornerRadius = 20 432 payButton.layer.cornerRadius = 20
420 payButton.activityIndicator.color = .white 433 payButton.activityIndicator.color = .white
421 payButton.layer.masksToBounds = true 434 payButton.layer.masksToBounds = true
422 - payButton.tag = 1003 435 + payButton.tag = 1004
423 payButton.backgroundColor = HexColor("#67C5FF") 436 payButton.backgroundColor = HexColor("#67C5FF")
424 payButton.titleLabel?.font = medium_adapt_font(pointSize: 15) 437 payButton.titleLabel?.font = medium_adapt_font(pointSize: 15)
425 payButton.addTarget(self, action: #selector(payMethod), for: .touchUpInside) 438 payButton.addTarget(self, action: #selector(payMethod), for: .touchUpInside)
metaCode/Supporting Files/Assets.xcassets/Video/short_video_free.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "short_video_free@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "short_video_free@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
metaCode/Supporting Files/Assets.xcassets/Video/short_video_free.imageset/short_video_free@2x.png 0 → 100644

2.86 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_free.imageset/short_video_free@3x.png 0 → 100644

5.77 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_pay.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "short_video_pay@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "short_video_pay@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
metaCode/Supporting Files/Assets.xcassets/Video/short_video_pay.imageset/short_video_pay@2x.png 0 → 100644

2.2 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_pay.imageset/short_video_pay@3x.png 0 → 100644

4.44 KB