Commit 84517028845a3ecb5705b139fea1326a41b4d957

Authored by liushiyu
1 parent de4afda2

解决播放器进度重播一直加载问题,回复列表添加显示不全问题

metaCode/Classes/Main/HomePage/View/VerticalViews/MainView/CNIDCardView.swift
... ... @@ -59,7 +59,7 @@ class CNIDCardView: UIView{
59 59  
60 60 func loadIDDetailData(){
61 61 // showLoading(message: "")
62   - CNLiveMineViewModel.requestsStandInfo(identityId: "\(_idModel!.id)", type: .havedate) { result, respStatue in
  62 + CNLiveMineViewModel.requestsStandInfo(identityId: "\(_idModel!.id)", type: .havedate, authType: .person) { result, respStatue in
63 63 hiddenLoading()
64 64 if respStatue == .success {
65 65 let cardArray = result as! NSMutableArray
... ...
metaCode/Classes/Main/HomePage/View/VerticalViews/MainView/CNMainView.swift
... ... @@ -279,7 +279,7 @@ class CNFrontMainView : UIView{
279 279 }
280 280 }
281 281 }else{
282   - navigationViewController().pushViewController(CNLiveMineInputViewController.init(listModel: self._idModel!), animated: pushAnimated)
  282 + navigationViewController().pushViewController(CNLiveMineInputViewController.init(listModel: self._idModel!, authType: .person), animated: pushAnimated)
283 283 }
284 284 }
285 285 }
... ...
metaCode/Classes/Main/MinePage/Controller/CNLiveMineAddInfoViewController.swift
... ... @@ -335,7 +335,7 @@ extension CNLiveMineAddInfoViewController {
335 335 }
336 336 }
337 337 } else {
338   - self.navigationController?.pushViewController(CNLiveMineInputViewController.init(listModel: listModel), animated: true)
  338 + self.navigationController?.pushViewController(CNLiveMineInputViewController.init(listModel: listModel, authType: .enterprise), animated: true)
339 339 }
340 340 }
341 341 }
... ...
metaCode/Classes/Main/MinePage/Controller/CNLiveMineAuthResultViewController.swift
... ... @@ -87,10 +87,12 @@ class CNLiveMineAuthResultViewController: CNLiveBaseViewController {
87 87 var _status: UIStatusBarStyle! = .lightContent
88 88 var _listModel:StandListModel!
89 89 var _show_type:CNLiveMineAuthResultShowType!
90   - init(_ listModel:StandListModel,show_type:CNLiveMineAuthResultShowType) {
  90 + var _authType:CNLiveMineInputAuthType!
  91 + init(_ listModel:StandListModel,show_type:CNLiveMineAuthResultShowType,authType:CNLiveMineInputAuthType) {
91 92 super.init(nibName:nil, bundle:nil)
92 93 _listModel = listModel
93 94 _show_type = show_type
  95 + _authType = authType
94 96 }
95 97  
96 98 required init?(coder: NSCoder) {
... ... @@ -194,7 +196,7 @@ class CNLiveMineAuthResultViewController: CNLiveBaseViewController {
194 196 }
195 197 sendButton.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: 1),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: 1)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5))
196 198  
197   - CNLiveMineViewModel.startKeepTimeWithStand(id: "\(_listModel.id)") { [weak self] result, respStatue in
  199 + CNLiveMineViewModel.startKeepTimeWithStand(id: "\(_listModel.id)", authType: _authType) { [weak self] result, respStatue in
198 200 if respStatue == .success {
199 201 let listBaseModel = result as! MineStandInfoBaseModel
200 202 self?.titleLabel.textColor = .black
... ...
metaCode/Classes/Main/MinePage/Controller/CNLiveMineInputViewController.swift
... ... @@ -9,6 +9,11 @@ import Foundation
9 9 import EmptyDataSet_Swift
10 10 import HXPHPicker
11 11 import APButton
  12 +enum CNLiveMineInputAuthType {
  13 + case person//个人认证
  14 + case enterprise//企业认证
  15 +}
  16 +
12 17 typealias resultUploadImageBlock = (_ url: String) -> Void
13 18 class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate, PhotoPickerControllerDelegate{
14 19  
... ... @@ -56,9 +61,11 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg
56 61 var select_image: UIImage!
57 62 var _listModel:StandListModel!
58 63 var tempCell:MineBodyInputAuthCell!
59   - init(listModel:StandListModel) {
  64 + var _authType:CNLiveMineInputAuthType!
  65 + init(listModel:StandListModel,authType:CNLiveMineInputAuthType) {
60 66 super.init(nibName:nil, bundle:nil)
61 67 _listModel = listModel
  68 + _authType = authType
62 69 }
63 70  
64 71 required init?(coder: NSCoder) {
... ... @@ -73,9 +80,7 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg
73 80 view.backgroundColor = HexColor("#F7F8FA")
74 81  
75 82 loadStandInfoData()
76   -
77   -
78   -
  83 +
79 84 view.addSubview(sendButton)
80 85 sendButton.snp.makeConstraints { make in
81 86 make.bottom.equalToSuperview().offset(-get_system_tabbar_ui_offsetHeight() - 20)
... ... @@ -103,7 +108,7 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg
103 108  
104 109 private func loadStandInfoData() {
105 110 showLoading(message: "")
106   - CNLiveMineViewModel.requestsStandInfo(identityId: "\(_listModel.id)", type: .nodate) {[weak self] result, respStatue in
  111 + CNLiveMineViewModel.requestsStandInfo(identityId: "\(_listModel.id)", type: .nodate, authType: _authType) {[weak self] result, respStatue in
107 112 if respStatue == .success {
108 113 self?.dataArray.addObjects(from: result as! [Any])
109 114 if (self?.dataArray.count)! > 0 {
... ... @@ -140,7 +145,7 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg
140 145 showMessage(message: "上传成功")
141 146 sendButton.stopAnimating()
142 147 DispatchQueue.main.asyncAfter(deadline: .now()+1) { [self] in
143   - self.navigationController?.pushViewController(CNLiveMineAuthResultViewController.init(_listModel,show_type: .result_success), animated: true)
  148 + self.navigationController?.pushViewController(CNLiveMineAuthResultViewController.init(_listModel,show_type: .result_success, authType: _authType), animated: true)
144 149 }
145 150 }
146 151 }
... ...
metaCode/Classes/Main/MinePage/Controller/CNLiveMineShopViewController.swift
... ... @@ -258,7 +258,7 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat
258 258 self.navigationController?.pushViewController(CNLiveMineShopViewController.init(showType: .two, listModel: _listModel, tempArray: temp_array), animated: true)
259 259 return
260 260 }
261   - let uploadKey = UploadManager.uploadImage(imageData: image.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in
  261 + _ = UploadManager.uploadImage(imageData: image.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in
262 262 print("获取进度==>\(progress)")
263 263 }, successBlock: { [self] key,url in
264 264 hiddenLoading()
... ... @@ -309,10 +309,10 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat
309 309 self.navigationController?.pushViewController(CNLiveMineShopViewController.init(showType: .three, listModel: _listModel, tempArray: temp_array), animated: true)
310 310 return
311 311 }
312   - let uploadKey = UploadManager.uploadImage(imageData: image_one.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in }, successBlock: { [self] key,url in
  312 + _ = UploadManager.uploadImage(imageData: image_one.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in }, successBlock: { [self] key,url in
313 313 temp_dict_one.removeObject(forKey: "content")
314 314 temp_dict_one.setObject(url, forKey: "content" as NSCopying)
315   - let uploadKey = UploadManager.uploadImage(imageData: image_two.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in }, successBlock: { [self] key,url in
  315 + _ = UploadManager.uploadImage(imageData: image_two.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in }, successBlock: { [self] key,url in
316 316 hiddenLoading()
317 317 temp_dict_two.removeObject(forKey: "content")
318 318 temp_dict_two.setObject(url, forKey: "content" as NSCopying)
... ... @@ -364,7 +364,7 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat
364 364 uploadWithMessage()
365 365 return
366 366 }
367   - let uploadKey = UploadManager.uploadImage(imageData: image_one.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in }, successBlock: { [self] key,url in
  367 + _ = UploadManager.uploadImage(imageData: image_one.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in }, successBlock: { [self] key,url in
368 368 temp_dict_one.removeObject(forKey: "content")
369 369 temp_dict_one.setObject(url, forKey: "content" as NSCopying)
370 370 if image_two == nil {
... ... @@ -372,7 +372,7 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat
372 372 temp_array.addObjects(from: threeArray as! [Any])
373 373 uploadWithMessage()
374 374 }else{
375   - let uploadKey = UploadManager.uploadImage(imageData: image_two.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in }, successBlock: { [self] key,url in
  375 + _ = UploadManager.uploadImage(imageData: image_two.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in }, successBlock: { [self] key,url in
376 376 hiddenLoading()
377 377 temp_dict_two.removeObject(forKey: "content")
378 378 temp_dict_two.setObject(url, forKey: "content" as NSCopying)
... ... @@ -405,7 +405,7 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat
405 405 if respStatue == .success {
406 406 showMessage(message: "上传成功")
407 407 DispatchQueue.main.asyncAfter(deadline: .now()+1) { [self] in
408   - self.navigationController?.pushViewController(CNLiveMineAuthResultViewController.init(StandListModel.init(), show_type: .detail_shop), animated: true)
  408 + self.navigationController?.pushViewController(CNLiveMineAuthResultViewController.init(StandListModel.init(), show_type: .detail_shop, authType: .person), animated: true)
409 409 }
410 410 } else {
411 411 }
... ...
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift
... ... @@ -216,6 +216,7 @@ final class StandListModel: BaseModel {//, TableCodable {
216 216 // !!!: /api/identityApi/getIdentity 接口标记
217 217 class MineStandInfoBaseModel: BaseModel {
218 218 var authInfos = [MineStandInfoModel]()
  219 + var enterpriseAuthInfos = [MineStandInfoModel]()
219 220 var icon: String?
220 221 var name: String?
221 222 var identityId: Int = 0
... ...
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
... ... @@ -461,11 +461,14 @@ class CNLiveMineViewModel: NSObject {
461 461 }
462 462 }
463 463  
  464 +
464 465 /// 获取身份信息数据
465 466 /// - Parameters:
466   - /// - identityId: 身份id
  467 + /// - identityId: 身份 id
  468 + /// - type: 获取身份信息类型
  469 + /// - authType: 认证类型 (只有当type为.nodate时有效)
467 470 /// - resultBlock: 返回
468   - static func requestsStandInfo(identityId: String, type: CNLiveMineGetWriteType, resultBlock: @escaping resultNewsBlock) {
  471 + static func requestsStandInfo(identityId: String, type: CNLiveMineGetWriteType, authType: CNLiveMineInputAuthType,resultBlock: @escaping resultNewsBlock) {
469 472 let param = NSMutableDictionary()
470 473 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")
471 474 param.setValue(identityId, forKey: "identityId")
... ... @@ -475,6 +478,7 @@ class CNLiveMineViewModel: NSObject {
475 478 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
476 479 CNLiveNetworking.setAllowRequestDefaultArgument(true)
477 480 CNLiveNetworking.setupShowDataResult(false)
  481 + CNLiveNetworking.setupShowResult(true)
478 482 CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/identityApi/getIdentity", param: param as! [String: String], cacheType: .networkOnly) { task, result, error in
479 483 hiddenLoading()
480 484 if (error == nil) {
... ... @@ -487,17 +491,37 @@ class CNLiveMineViewModel: NSObject {
487 491 let newsModel = dictionaryToModel(resp as! [String : Any], MineStandInfoBaseModel.self,"data") as! MineStandInfoBaseModel
488 492 if type == .nodate {
489 493 let tempArray = NSMutableArray()
490   - for authinfo in newsModel.authInfos {
491   - if authinfo.input {
492   - tempArray.add(authinfo)
  494 + if authType == .person {
  495 + for authinfo in newsModel.authInfos {
  496 + if authinfo.input {
  497 + tempArray.add(authinfo)
  498 + }
  499 + }
  500 + }
  501 + if authType == .enterprise {
  502 + for authinfo in newsModel.enterpriseAuthInfos {
  503 + if authinfo.input {
  504 + tempArray.add(authinfo)
  505 + }
493 506 }
494 507 }
495 508 resultBlock(tempArray,.success)
496 509 }else if (type == .effect) {
497 510 resultBlock(newsModel,.success)
498 511 }else {
499   - let tempArray = NSMutableArray.init(array: newsModel.authInfos)
500   - resultBlock(tempArray,.success)
  512 + if newsModel.authInfos.count > 0 {
  513 + let tempArray = NSMutableArray.init(array: newsModel.authInfos)
  514 + resultBlock(tempArray,.success)
  515 + } else if newsModel.enterpriseAuthInfos.count > 0 {
  516 + let tempArray = NSMutableArray.init(array: newsModel.enterpriseAuthInfos)
  517 + resultBlock(tempArray,.success)
  518 + } else if newsModel.authInfos.count > 0 && newsModel.enterpriseAuthInfos.count > 0 {
  519 + let tempArray_ent = NSMutableArray.init(array: newsModel.enterpriseAuthInfos)
  520 + let tempArray_persion = NSMutableArray.init(array: newsModel.authInfos)
  521 + resultBlock([tempArray_persion, tempArray_ent],.success)
  522 + } else {
  523 + resultBlock(Array<Any>(),.success)
  524 + }
501 525 }
502 526 }
503 527 } else {
... ... @@ -598,7 +622,7 @@ class CNLiveMineViewModel: NSObject {
598 622  
599 623 /// 结果检查逻辑
600 624 /// - Parameter id: 当前身份
601   - static func startKeepTimeWithStand(id: String, resultBlock: @escaping resultNewsBlock) {
  625 + static func startKeepTimeWithStand(id: String, authType: CNLiveMineInputAuthType,resultBlock: @escaping resultNewsBlock) {
602 626 // 定义需要计时的时间
603 627 var timeCount = 20
604 628 // 在global线程里创建一个时间源
... ... @@ -615,7 +639,7 @@ class CNLiveMineViewModel: NSObject {
615 639 // 返回主线程处理一些事件,更新UI等等
616 640 DispatchQueue.main.async {
617 641 showLoading(message: "")
618   - CNLiveMineViewModel.requestsStandInfo(identityId: id, type: .effect) { result, respStatue in
  642 + CNLiveMineViewModel.requestsStandInfo(identityId: id, type: .effect, authType: authType) { result, respStatue in
619 643 if respStatue == .success {
620 644 let listBaseModel = result as! MineStandInfoBaseModel
621 645 if listBaseModel.authTime > 0 || listBaseModel.code!.count > 0 {
... ...
metaCode/Classes/Main/VideoPage/Controller/CNLiveShortVideoViewController.swift
... ... @@ -178,6 +178,10 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele
178 178 }
179 179 self.playVideo(at: indexPath)
180 180 }
  181 + player.playerDidToEnd = {[weak self] asset in
  182 + guard let self = self else { return }
  183 + self.controlView.videoPlayer((self.player)!)
  184 + }
181 185  
182 186 NotificationCenter.default.addObserver(self, selector: #selector(removePlayerAction), name: Notification.Name.PlayerManage.kPlayerDestroyNotification, object: nil)
183 187 }
... ...
metaCode/Classes/Main/VideoPage/View/CNLiveShortVideoCommentListView.swift
... ... @@ -105,6 +105,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD
105 105 return array
106 106 }()
107 107  
  108 + var isReset: Bool! = false
108 109 var total_hd: Int! = 0
109 110 var videoId: String!
110 111 var contentSid: String!
... ... @@ -153,6 +154,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD
153 154 func addRefreshView() {
154 155 let headerRefreshView: CNLiveHeaderRefresh = CNLiveHeaderRefresh(refreshingBlock: { [weak self] in
155 156 guard let self = self else { return }
  157 + self.isReset = true
156 158 self.pageNum = 0
157 159 self.requestDataSource()
158 160 })
... ... @@ -274,7 +276,7 @@ extension CNLiveShortVideoCommentListView {
274 276 guard let cell = tableView.dequeueReusableCell(withIdentifier: kShortVideoCommentListTableViewCellIdentifier) as? CNLiveShortVideoCommentListTableViewCell else {
275 277 return CNLiveShortVideoCommentListTableViewCell()
276 278 }
277   - cell.setupWithDataSource(commentData: (dataArray[indexPath.row] as! ShortVideoHomeCommentListModel).comment, replyData: (dataArray[indexPath.row] as! ShortVideoHomeCommentListModel).replyData, tableView_h: (dataArray[indexPath.row] as! ShortVideoHomeCommentListModel).tableView_h, tableView_top: (dataArray[indexPath.row] as! ShortVideoHomeCommentListModel).tableView_top, indexPath: indexPath, pageNumber: self.pageNum)
  279 + cell.setupWithDataSource(commentData: (dataArray[indexPath.row] as! ShortVideoHomeCommentListModel).comment, replyData: (dataArray[indexPath.row] as! ShortVideoHomeCommentListModel).replyData, tableView_h: (dataArray[indexPath.row] as! ShortVideoHomeCommentListModel).tableView_h, tableView_top: (dataArray[indexPath.row] as! ShortVideoHomeCommentListModel).tableView_top, indexPath: indexPath, isReset: isReset)
278 280 cell.reloadRowBlock = {[weak self] viewCell, cell_h in
279 281 guard let self = self else { return }
280 282 let commentModel_temp = self.dataArray[viewCell.indexPath_current.row] as! ShortVideoHomeCommentListModel
... ... @@ -533,10 +535,8 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel
533 535 contentView.addSubview(tableView)
534 536 }
535 537  
536   - func setupWithDataSource(commentData: ShortVideoHomeCommentFListModel, replyData: ShortVideoHomeCommentRListModel, tableView_h: CGFloat, tableView_top: CGFloat, indexPath: IndexPath, pageNumber: Int) {
537   - if pageNumber == 0 {
538   - dataSource.removeAllObjects()
539   - }
  538 + func setupWithDataSource(commentData: ShortVideoHomeCommentFListModel, replyData: ShortVideoHomeCommentRListModel, tableView_h: CGFloat, tableView_top: CGFloat, indexPath: IndexPath, isReset: Bool) {
  539 + dataSource.removeAllObjects()
540 540 dataSource.addObjects(from: replyData.replys)
541 541 tableView_height = tableView_h
542 542 indexPath_current = indexPath
... ... @@ -574,6 +574,7 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel
574 574 make.right.equalToSuperview().offset(-10)
575 575 make.height.equalTo(commentData.nickLayout.textBoundingRect.size.height)
576 576 }
  577 + self.tableView.snp.removeConstraints()
577 578 self.tableView.removeFromSuperview()
578 579 if replyData.replyCount ?? 0 > 2 {
579 580 self.contentView.addSubview(self.tableView)
... ...
metaCode/Classes/Main/VideoPage/View/CNLiveShortVideoControlView.swift
... ... @@ -29,6 +29,7 @@ class CNLiveShortVideoControlView: UIView, ZFPlayerMediaControl {
29 29 return sliderView
30 30 }()
31 31  
  32 + var bufferComplete: Bool! = false
32 33  
33 34 override init(frame: CGRect) {
34 35 super.init(frame: frame)
... ... @@ -70,9 +71,8 @@ class CNLiveShortVideoControlView: UIView, ZFPlayerMediaControl {
70 71 required init?(coder: NSCoder) {
71 72 fatalError("init(coder:) has not been implemented")
72 73 }
73   -
74 74 func videoPlayer(_ videoPlayer: ZFPlayerController, loadStateChanged state: ZFPlayerLoadState) {
75   - if (state == .stalled || state == .prepare) && videoPlayer.currentPlayerManager.isPlaying {
  75 + if (state == .stalled) && videoPlayer.currentPlayerManager.isPlaying && !bufferComplete {
76 76 self.sliderView.startAnimating()
77 77 } else {
78 78 self.sliderView.stopAnimating()
... ... @@ -86,6 +86,21 @@ class CNLiveShortVideoControlView: UIView, ZFPlayerMediaControl {
86 86 func videoPlayer(_ videoPlayer: ZFPlayerController, bufferTime: TimeInterval) {
87 87 self.sliderView.bufferValue = videoPlayer.bufferProgress
88 88 }
  89 +
  90 + func videoPlayer(_ videoPlayer: ZFPlayerController) {
  91 + videoPlayer.currentPlayerManager.play()
  92 + self.bufferComplete = true
  93 + }
  94 +
  95 +
  96 + func videoPlayer(_ videoPlayer: ZFPlayerController, reachabilityChanged status: ZFReachabilityStatus) {
  97 + if status == .reachableVia2G
  98 + || status == .reachableVia3G
  99 + || status == .reachableVia4G
  100 + || status == .reachableVia5G {
  101 + showMessage(message: "正在使用流量播放")
  102 + }
  103 + }
89 104  
90 105 func gestureSingleTapped(_ gestureControl: ZFPlayerGestureControl) {
91 106 if (self.player?.currentPlayerManager.isPlaying == true) {
... ...