Commit 86105f9d8b675b17227bfd17a3fcad54c9cb96b2
1 parent
b4539eab
专辑头像修改,试听功能修改,集数显示添加,评论回复点赞错误问题。
Showing
6 changed files
with
43 additions
and
21 deletions
metaCode/Classes/Main/HomePages/Model/CNLiveAlbumModel.swift
| @@ -48,8 +48,8 @@ class CNLiveAlbumProductModel:BaseModel{ | @@ -48,8 +48,8 @@ class CNLiveAlbumProductModel:BaseModel{ | ||
| 48 | var productId = "" | 48 | var productId = "" |
| 49 | var productTitle = "" | 49 | var productTitle = "" |
| 50 | var productImg = "" | 50 | var productImg = "" |
| 51 | - var albumProductType = ""//专辑类型 | ||
| 52 | - var productType = ""//类型 0免费 1积分 2付费 3 4试听 | 51 | + var albumProductType = ""/// 专辑付费类型 0 免费(默认) 1 积分 2 人民币 3 中国币(不用) 4 试听 5 专辑收费 6兑换码兑换 |
| 52 | + var productType = ""/// 单个视频付费类型 0 免费(默认) 1 积分 2 人民币 3 中国币(不用) 4 试听 5 专辑收费 6兑换码兑换 | ||
| 53 | var androidRmb = "" | 53 | var androidRmb = "" |
| 54 | var androidOriginalRmb = "" | 54 | var androidOriginalRmb = "" |
| 55 | var iosOriginalRmb = "" | 55 | var iosOriginalRmb = "" |
| @@ -62,7 +62,7 @@ class CNLiveAlbumProductModel:BaseModel{ | @@ -62,7 +62,7 @@ class CNLiveAlbumProductModel:BaseModel{ | ||
| 62 | var validPeriod = "" | 62 | var validPeriod = "" |
| 63 | var expiryDate = "" | 63 | var expiryDate = "" |
| 64 | var effectiveDate = "" | 64 | var effectiveDate = "" |
| 65 | - var check = false////false需要付费 true免费或者付过费 | 65 | + var check = false/// 判断是否已购买或者免费, 0: 需要付费 1:免费或者付过费 null:免费 |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | 68 |
metaCode/Classes/Main/VideoPage/Controller/CNLiveShortVideoViewController.swift
| @@ -156,8 +156,13 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | @@ -156,8 +156,13 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | ||
| 156 | self.controlView.videoPlayer((self.player)!, currentTime: self.player.currentTime, totalTime: self.player.totalTime) | 156 | self.controlView.videoPlayer((self.player)!, currentTime: self.player.currentTime, totalTime: self.player.totalTime) |
| 157 | let index = self.dataURLArray.index(of: assetURL.absoluteString) | 157 | let index = self.dataURLArray.index(of: assetURL.absoluteString) |
| 158 | let homeModel = self.dataArray[index] as! CNLiveAlbumListModel | 158 | let homeModel = self.dataArray[index] as! CNLiveAlbumListModel |
| 159 | + self.currentIndex = index | ||
| 159 | if homeModel.product?.check == false { | 160 | if homeModel.product?.check == false { |
| 160 | - (self.player)!.stopCurrentPlayingCell() | 161 | + if homeModel.product?.productType == "4" { |
| 162 | + //这里表示可以进行试听 | ||
| 163 | + } else { | ||
| 164 | + (self.player)!.stopCurrentPlayingCell() | ||
| 165 | + } | ||
| 161 | } | 166 | } |
| 162 | } | 167 | } |
| 163 | // 更新另一个控制层的时间 | 168 | // 更新另一个控制层的时间 |
| @@ -191,6 +196,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | @@ -191,6 +196,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | ||
| 191 | footerRefreshView = CNLiveFooterRefresh(refreshingBlock: { [weak self] in | 196 | footerRefreshView = CNLiveFooterRefresh(refreshingBlock: { [weak self] in |
| 192 | guard let self = self else { return } | 197 | guard let self = self else { return } |
| 193 | self.player.stopCurrentPlayingCell() | 198 | self.player.stopCurrentPlayingCell() |
| 199 | + self.currentIndex = 0 | ||
| 194 | self.pageNum += 1 | 200 | self.pageNum += 1 |
| 195 | self.requestData {} | 201 | self.requestData {} |
| 196 | }) | 202 | }) |
| @@ -238,8 +244,10 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | @@ -238,8 +244,10 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | ||
| 238 | } | 244 | } |
| 239 | self.tableView.refreshControl?.endRefreshing() | 245 | self.tableView.refreshControl?.endRefreshing() |
| 240 | self.tableView.reloadData() | 246 | self.tableView.reloadData() |
| 241 | - DispatchQueue.main.async { | ||
| 242 | - self.tableView.contentOffset = CGPoint.zero | 247 | + if self.pageNum == 1 { |
| 248 | + DispatchQueue.main.async { | ||
| 249 | + self.tableView.contentOffset = CGPoint.zero | ||
| 250 | + } | ||
| 243 | } | 251 | } |
| 244 | let hasNextPage = (result as! [Any])[1] as! Bool | 252 | let hasNextPage = (result as! [Any])[1] as! Bool |
| 245 | if listArray.count == 0 && urlArray.count == 0 { | 253 | if listArray.count == 0 && urlArray.count == 0 { |
| @@ -254,6 +262,8 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | @@ -254,6 +262,8 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele | ||
| 254 | } | 262 | } |
| 255 | if self.pageNum == 1 { | 263 | if self.pageNum == 1 { |
| 256 | self.playTheIndex(index: self.currentIndex) | 264 | self.playTheIndex(index: self.currentIndex) |
| 265 | + } else { | ||
| 266 | + self.playTheIndex(index: (self.pageNum - 1)*10) | ||
| 257 | } | 267 | } |
| 258 | } else { | 268 | } else { |
| 259 | if self.tableView.mj_footer != nil { | 269 | if self.tableView.mj_footer != nil { |
metaCode/Classes/Main/VideoPage/View/CNLiveShortVideoCommentListView.swift
| @@ -130,7 +130,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | @@ -130,7 +130,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD | ||
| 130 | } | 130 | } |
| 131 | self.tableView.mj_header?.endRefreshing() | 131 | self.tableView.mj_header?.endRefreshing() |
| 132 | 132 | ||
| 133 | - if self.tableView.mj_footer == nil { | 133 | + if self.tableView.mj_footer == nil && listArray.count > 0 { |
| 134 | self.tableView.mj_footer = footerRefreshView | 134 | self.tableView.mj_footer = footerRefreshView |
| 135 | } | 135 | } |
| 136 | let hasNextPage = (result as! ShortVideoHomeCommentModel).hasNext! | 136 | let hasNextPage = (result as! ShortVideoHomeCommentModel).hasNext! |
| @@ -688,9 +688,9 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | @@ -688,9 +688,9 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel | ||
| 688 | } | 688 | } |
| 689 | 689 | ||
| 690 | @objc func likeActionMethod(button: UIButton) { | 690 | @objc func likeActionMethod(button: UIButton) { |
| 691 | - let contentId: String = commentModel == nil ? replyItemModel.replyId! : commentModel.commentId! | ||
| 692 | - let support: Bool = commentModel == nil ? replyItemModel.isPraised! : commentModel.isPraised! | ||
| 693 | - let isComment: Bool = commentModel != nil | 691 | + let contentId: String = replyItemModel != nil ? replyItemModel.replyId! : commentModel.commentId! |
| 692 | + let support: Bool = replyItemModel != nil ? replyItemModel.isPraised! : commentModel.isPraised! | ||
| 693 | + let isComment: Bool = replyItemModel == nil | ||
| 694 | CNLiveShortVideoViewModel.requestCommentWithLike(contentId: contentId, support: support, isComment: isComment) {[weak self] result, respStatue in | 694 | CNLiveShortVideoViewModel.requestCommentWithLike(contentId: contentId, support: support, isComment: isComment) {[weak self] result, respStatue in |
| 695 | guard let self = self else { return } | 695 | guard let self = self else { return } |
| 696 | if respStatue == .success { | 696 | if respStatue == .success { |
metaCode/Classes/Main/VideoPage/View/CNLiveShortVideoContentListView.swift
| @@ -253,8 +253,13 @@ class CNLiveShortVideoContentListTableViewCell: UITableViewCell { | @@ -253,8 +253,13 @@ class CNLiveShortVideoContentListTableViewCell: UITableViewCell { | ||
| 253 | tipView.image = UIImage(named: "short_video_free") | 253 | tipView.image = UIImage(named: "short_video_free") |
| 254 | } | 254 | } |
| 255 | } else { | 255 | } else { |
| 256 | - tipView.isHidden = false | ||
| 257 | - tipView.image = UIImage(named: "short_video_pay") | 256 | + if listModel.product?.productType == "4" { |
| 257 | + //这里表示可以进行试听 | ||
| 258 | + tipView.isHidden = true | ||
| 259 | + } else { | ||
| 260 | + tipView.isHidden = false | ||
| 261 | + tipView.image = UIImage(named: "short_video_pay") | ||
| 262 | + } | ||
| 258 | } | 263 | } |
| 259 | } | 264 | } |
| 260 | 265 |
metaCode/Classes/Main/VideoPage/View/CNLiveShortVideoListTableViewCell.swift
| @@ -179,15 +179,16 @@ class CNLiveShortVideoListTableViewCell: UITableViewCell { | @@ -179,15 +179,16 @@ class CNLiveShortVideoListTableViewCell: UITableViewCell { | ||
| 179 | homeModel = model | 179 | homeModel = model |
| 180 | coverImageView.kf.indicatorType = .activity | 180 | coverImageView.kf.indicatorType = .activity |
| 181 | coverImageView.kf.setImage(with: URL(string: model.poster), placeholder: UIImage(named: "short_video_default")) | 181 | coverImageView.kf.setImage(with: URL(string: model.poster), placeholder: UIImage(named: "short_video_default")) |
| 182 | - iconBtn.kf.setImage(with: URL(string: model.icon!.face), for: .normal) | ||
| 183 | - likeBtn.setTitle(model.tool?.likesNum, for: .normal) | ||
| 184 | - commentBtn.setTitle(model.tool?.commentsNum, for: .normal) | 182 | + iconBtn.imageView!.kf.indicatorType = .activity |
| 183 | + iconBtn.kf.setImage(with: URL(string: model.albumMsgModel!.albumImg), for: .normal) | ||
| 184 | + likeBtn.setTitle(model.tool!.likesNum, for: .normal) | ||
| 185 | + commentBtn.setTitle(model.tool!.commentsNum, for: .normal) | ||
| 185 | shareBtn.setTitle(model.tool?.shareNum, for: .normal) | 186 | shareBtn.setTitle(model.tool?.shareNum, for: .normal) |
| 186 | likeBtn.isSelected = model.tool!.liked | 187 | likeBtn.isSelected = model.tool!.liked |
| 187 | titleLabel.text = model.shortTitle | 188 | titleLabel.text = model.shortTitle |
| 188 | descLabel.text = model.title | 189 | descLabel.text = model.title |
| 189 | faviBtn.isHidden = model.albumMsgModel!.collection | 190 | faviBtn.isHidden = model.albumMsgModel!.collection |
| 190 | - listBtn.setTitle(model.albumMsgModel?.albumName, for: .normal) | 191 | + listBtn.setTitle("\(model.albumMsgModel!.albumName)·\(model.albumMsgModel!.episodeNow)集", for: .normal) |
| 191 | 192 | ||
| 192 | let imageV: UIImageView = payView.viewWithTag(1000) as! UIImageView | 193 | let imageV: UIImageView = payView.viewWithTag(1000) as! UIImageView |
| 193 | imageV.kf.indicatorType = .activity | 194 | imageV.kf.indicatorType = .activity |
| @@ -203,11 +204,16 @@ class CNLiveShortVideoListTableViewCell: UITableViewCell { | @@ -203,11 +204,16 @@ class CNLiveShortVideoListTableViewCell: UITableViewCell { | ||
| 203 | //免费或者付过费了 | 204 | //免费或者付过费了 |
| 204 | hiddenView(isHidden: false) | 205 | hiddenView(isHidden: false) |
| 205 | } else { | 206 | } else { |
| 206 | - //需要付费 | ||
| 207 | - hiddenView(isHidden: true) | ||
| 208 | - payButton.setTitle("\(model.product!.point)积分解锁全集", for: .normal) | ||
| 209 | - tipV.isHidden = false | ||
| 210 | - tipV.image = UIImage(named: "short_video_pay") | 207 | + if model.product?.productType == "4" { |
| 208 | + //这里表示可以进行试听 | ||
| 209 | + hiddenView(isHidden: false) | ||
| 210 | + } else { | ||
| 211 | + //需要付费 | ||
| 212 | + hiddenView(isHidden: true) | ||
| 213 | + payButton.setTitle("\(model.product!.point)积分解锁全集", for: .normal) | ||
| 214 | + tipV.isHidden = false | ||
| 215 | + tipV.image = UIImage(named: "short_video_pay") | ||
| 216 | + } | ||
| 211 | } | 217 | } |
| 212 | } | 218 | } |
| 213 | 219 |
metaCode/Classes/Main/VideoPage/ViewModel/CNLiveShortVideoViewModel.swift
| @@ -27,6 +27,7 @@ class CNLiveShortVideoViewModel: NSObject { | @@ -27,6 +27,7 @@ class CNLiveShortVideoViewModel: NSObject { | ||
| 27 | custom_param.setValue(CNLiveMCEnvironmentManager.shared.appKey_wjj, forKey: "appKey") | 27 | custom_param.setValue(CNLiveMCEnvironmentManager.shared.appKey_wjj, forKey: "appKey") |
| 28 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 28 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 29 | CNLiveNetworking.setupShowDataResult(false) | 29 | CNLiveNetworking.setupShowDataResult(false) |
| 30 | + CNLiveNetworking.setupShowResult(true) | ||
| 30 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 31 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| 31 | CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseCMSUrl+"/ugcApi/albumList", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | 32 | CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseCMSUrl+"/ugcApi/albumList", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in |
| 32 | hiddenLoading() | 33 | hiddenLoading() |