Commit 9aaeca126cd2ff3e0a67bf8f6b595ed5bc05a6d6

Authored by “张旭”
2 parents 3cbba7ba 8ae10b35
metaCode/Classes/Main/HomePage/View/VerticalViews/MainView/CNIDCardView.swift
@@ -59,7 +59,7 @@ class CNIDCardView: UIView{ @@ -59,7 +59,7 @@ class CNIDCardView: UIView{
59 59
60 func loadIDDetailData(){ 60 func loadIDDetailData(){
61 // showLoading(message: "") 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 hiddenLoading() 63 hiddenLoading()
64 if respStatue == .success { 64 if respStatue == .success {
65 let cardArray = result as! NSMutableArray 65 let cardArray = result as! NSMutableArray
metaCode/Classes/Main/HomePage/View/VerticalViews/MainView/CNMainView.swift
@@ -311,7 +311,7 @@ class CNFrontMainView : UIView{ @@ -311,7 +311,7 @@ class CNFrontMainView : UIView{
311 } 311 }
312 } 312 }
313 }else{ 313 }else{
314 - navigationViewController().pushViewController(CNLiveMineInputViewController.init(listModel: self._idModel!), animated: pushAnimated) 314 + navigationViewController().pushViewController(CNLiveMineInputViewController.init(listModel: self._idModel!, authType: .person), animated: pushAnimated)
315 } 315 }
316 } 316 }
317 } 317 }
metaCode/Classes/Main/MinePage/Controller/CNLiveMineAddInfoViewController.swift
@@ -335,7 +335,7 @@ extension CNLiveMineAddInfoViewController { @@ -335,7 +335,7 @@ extension CNLiveMineAddInfoViewController {
335 } 335 }
336 } 336 }
337 } else { 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,10 +87,12 @@ class CNLiveMineAuthResultViewController: CNLiveBaseViewController {
87 var _status: UIStatusBarStyle! = .lightContent 87 var _status: UIStatusBarStyle! = .lightContent
88 var _listModel:StandListModel! 88 var _listModel:StandListModel!
89 var _show_type:CNLiveMineAuthResultShowType! 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 super.init(nibName:nil, bundle:nil) 92 super.init(nibName:nil, bundle:nil)
92 _listModel = listModel 93 _listModel = listModel
93 _show_type = show_type 94 _show_type = show_type
  95 + _authType = authType
94 } 96 }
95 97
96 required init?(coder: NSCoder) { 98 required init?(coder: NSCoder) {
@@ -194,7 +196,7 @@ class CNLiveMineAuthResultViewController: CNLiveBaseViewController { @@ -194,7 +196,7 @@ class CNLiveMineAuthResultViewController: CNLiveBaseViewController {
194 } 196 }
195 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)) 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 if respStatue == .success { 200 if respStatue == .success {
199 let listBaseModel = result as! MineStandInfoBaseModel 201 let listBaseModel = result as! MineStandInfoBaseModel
200 self?.titleLabel.textColor = .black 202 self?.titleLabel.textColor = .black
metaCode/Classes/Main/MinePage/Controller/CNLiveMineInputViewController.swift
@@ -9,6 +9,11 @@ import Foundation @@ -9,6 +9,11 @@ import Foundation
9 import EmptyDataSet_Swift 9 import EmptyDataSet_Swift
10 import HXPHPicker 10 import HXPHPicker
11 import APButton 11 import APButton
  12 +enum CNLiveMineInputAuthType {
  13 + case person//个人认证
  14 + case enterprise//企业认证
  15 +}
  16 +
12 typealias resultUploadImageBlock = (_ url: String) -> Void 17 typealias resultUploadImageBlock = (_ url: String) -> Void
13 class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate, PhotoPickerControllerDelegate{ 18 class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate, PhotoPickerControllerDelegate{
14 19
@@ -56,9 +61,11 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg @@ -56,9 +61,11 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg
56 var select_image: UIImage! 61 var select_image: UIImage!
57 var _listModel:StandListModel! 62 var _listModel:StandListModel!
58 var tempCell:MineBodyInputAuthCell! 63 var tempCell:MineBodyInputAuthCell!
59 - init(listModel:StandListModel) { 64 + var _authType:CNLiveMineInputAuthType!
  65 + init(listModel:StandListModel,authType:CNLiveMineInputAuthType) {
60 super.init(nibName:nil, bundle:nil) 66 super.init(nibName:nil, bundle:nil)
61 _listModel = listModel 67 _listModel = listModel
  68 + _authType = authType
62 } 69 }
63 70
64 required init?(coder: NSCoder) { 71 required init?(coder: NSCoder) {
@@ -73,9 +80,7 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg @@ -73,9 +80,7 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg
73 view.backgroundColor = HexColor("#F7F8FA") 80 view.backgroundColor = HexColor("#F7F8FA")
74 81
75 loadStandInfoData() 82 loadStandInfoData()
76 -  
77 -  
78 - 83 +
79 view.addSubview(sendButton) 84 view.addSubview(sendButton)
80 sendButton.snp.makeConstraints { make in 85 sendButton.snp.makeConstraints { make in
81 make.bottom.equalToSuperview().offset(-get_system_tabbar_ui_offsetHeight() - 20) 86 make.bottom.equalToSuperview().offset(-get_system_tabbar_ui_offsetHeight() - 20)
@@ -103,7 +108,7 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg @@ -103,7 +108,7 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg
103 108
104 private func loadStandInfoData() { 109 private func loadStandInfoData() {
105 showLoading(message: "") 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 if respStatue == .success { 112 if respStatue == .success {
108 self?.dataArray.addObjects(from: result as! [Any]) 113 self?.dataArray.addObjects(from: result as! [Any])
109 if (self?.dataArray.count)! > 0 { 114 if (self?.dataArray.count)! > 0 {
@@ -140,7 +145,7 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg @@ -140,7 +145,7 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg
140 showMessage(message: "上传成功") 145 showMessage(message: "上传成功")
141 sendButton.stopAnimating() 146 sendButton.stopAnimating()
142 DispatchQueue.main.asyncAfter(deadline: .now()+1) { [self] in 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,7 +258,7 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat
258 self.navigationController?.pushViewController(CNLiveMineShopViewController.init(showType: .two, listModel: _listModel, tempArray: temp_array), animated: true) 258 self.navigationController?.pushViewController(CNLiveMineShopViewController.init(showType: .two, listModel: _listModel, tempArray: temp_array), animated: true)
259 return 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 print("获取进度==>\(progress)") 262 print("获取进度==>\(progress)")
263 }, successBlock: { [self] key,url in 263 }, successBlock: { [self] key,url in
264 hiddenLoading() 264 hiddenLoading()
@@ -309,10 +309,10 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat @@ -309,10 +309,10 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat
309 self.navigationController?.pushViewController(CNLiveMineShopViewController.init(showType: .three, listModel: _listModel, tempArray: temp_array), animated: true) 309 self.navigationController?.pushViewController(CNLiveMineShopViewController.init(showType: .three, listModel: _listModel, tempArray: temp_array), animated: true)
310 return 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 temp_dict_one.removeObject(forKey: "content") 313 temp_dict_one.removeObject(forKey: "content")
314 temp_dict_one.setObject(url, forKey: "content" as NSCopying) 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 hiddenLoading() 316 hiddenLoading()
317 temp_dict_two.removeObject(forKey: "content") 317 temp_dict_two.removeObject(forKey: "content")
318 temp_dict_two.setObject(url, forKey: "content" as NSCopying) 318 temp_dict_two.setObject(url, forKey: "content" as NSCopying)
@@ -364,7 +364,7 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat @@ -364,7 +364,7 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat
364 uploadWithMessage() 364 uploadWithMessage()
365 return 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 temp_dict_one.removeObject(forKey: "content") 368 temp_dict_one.removeObject(forKey: "content")
369 temp_dict_one.setObject(url, forKey: "content" as NSCopying) 369 temp_dict_one.setObject(url, forKey: "content" as NSCopying)
370 if image_two == nil { 370 if image_two == nil {
@@ -372,7 +372,7 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat @@ -372,7 +372,7 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat
372 temp_array.addObjects(from: threeArray as! [Any]) 372 temp_array.addObjects(from: threeArray as! [Any])
373 uploadWithMessage() 373 uploadWithMessage()
374 }else{ 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 hiddenLoading() 376 hiddenLoading()
377 temp_dict_two.removeObject(forKey: "content") 377 temp_dict_two.removeObject(forKey: "content")
378 temp_dict_two.setObject(url, forKey: "content" as NSCopying) 378 temp_dict_two.setObject(url, forKey: "content" as NSCopying)
@@ -405,7 +405,7 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat @@ -405,7 +405,7 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat
405 if respStatue == .success { 405 if respStatue == .success {
406 showMessage(message: "上传成功") 406 showMessage(message: "上传成功")
407 DispatchQueue.main.asyncAfter(deadline: .now()+1) { [self] in 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 } else { 410 } else {
411 } 411 }
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift
@@ -218,6 +218,7 @@ final class StandListModel: BaseModel {//, TableCodable { @@ -218,6 +218,7 @@ final class StandListModel: BaseModel {//, TableCodable {
218 // !!!: /api/identityApi/getIdentity 接口标记 218 // !!!: /api/identityApi/getIdentity 接口标记
219 class MineStandInfoBaseModel: BaseModel { 219 class MineStandInfoBaseModel: BaseModel {
220 var authInfos = [MineStandInfoModel]() 220 var authInfos = [MineStandInfoModel]()
  221 + var enterpriseAuthInfos = [MineStandInfoModel]()
221 var icon: String? 222 var icon: String?
222 var name: String? 223 var name: String?
223 var identityId: Int = 0 224 var identityId: Int = 0
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
@@ -461,11 +461,14 @@ class CNLiveMineViewModel: NSObject { @@ -461,11 +461,14 @@ class CNLiveMineViewModel: NSObject {
461 } 461 }
462 } 462 }
463 463
  464 +
464 /// 获取身份信息数据 465 /// 获取身份信息数据
465 /// - Parameters: 466 /// - Parameters:
466 - /// - identityId: 身份id 467 + /// - identityId: 身份 id
  468 + /// - type: 获取身份信息类型
  469 + /// - authType: 认证类型 (只有当type为.nodate时有效)
467 /// - resultBlock: 返回 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 let param = NSMutableDictionary() 472 let param = NSMutableDictionary()
470 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") 473 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")
471 param.setValue(identityId, forKey: "identityId") 474 param.setValue(identityId, forKey: "identityId")
@@ -475,6 +478,7 @@ class CNLiveMineViewModel: NSObject { @@ -475,6 +478,7 @@ class CNLiveMineViewModel: NSObject {
475 CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) 478 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
476 CNLiveNetworking.setAllowRequestDefaultArgument(true) 479 CNLiveNetworking.setAllowRequestDefaultArgument(true)
477 CNLiveNetworking.setupShowDataResult(false) 480 CNLiveNetworking.setupShowDataResult(false)
  481 + CNLiveNetworking.setupShowResult(true)
478 CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/identityApi/getIdentity", param: param as! [String: String], cacheType: .networkOnly) { task, result, error in 482 CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/identityApi/getIdentity", param: param as! [String: String], cacheType: .networkOnly) { task, result, error in
479 hiddenLoading() 483 hiddenLoading()
480 if (error == nil) { 484 if (error == nil) {
@@ -487,17 +491,37 @@ class CNLiveMineViewModel: NSObject { @@ -487,17 +491,37 @@ class CNLiveMineViewModel: NSObject {
487 let newsModel = dictionaryToModel(resp as! [String : Any], MineStandInfoBaseModel.self,"data") as! MineStandInfoBaseModel 491 let newsModel = dictionaryToModel(resp as! [String : Any], MineStandInfoBaseModel.self,"data") as! MineStandInfoBaseModel
488 if type == .nodate { 492 if type == .nodate {
489 let tempArray = NSMutableArray() 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 resultBlock(tempArray,.success) 508 resultBlock(tempArray,.success)
496 }else if (type == .effect) { 509 }else if (type == .effect) {
497 resultBlock(newsModel,.success) 510 resultBlock(newsModel,.success)
498 }else { 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 } else { 527 } else {
@@ -598,7 +622,7 @@ class CNLiveMineViewModel: NSObject { @@ -598,7 +622,7 @@ class CNLiveMineViewModel: NSObject {
598 622
599 /// 结果检查逻辑 623 /// 结果检查逻辑
600 /// - Parameter id: 当前身份 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 var timeCount = 20 627 var timeCount = 20
604 // 在global线程里创建一个时间源 628 // 在global线程里创建一个时间源
@@ -615,7 +639,7 @@ class CNLiveMineViewModel: NSObject { @@ -615,7 +639,7 @@ class CNLiveMineViewModel: NSObject {
615 // 返回主线程处理一些事件,更新UI等等 639 // 返回主线程处理一些事件,更新UI等等
616 DispatchQueue.main.async { 640 DispatchQueue.main.async {
617 showLoading(message: "") 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 if respStatue == .success { 643 if respStatue == .success {
620 let listBaseModel = result as! MineStandInfoBaseModel 644 let listBaseModel = result as! MineStandInfoBaseModel
621 if listBaseModel.authTime > 0 || listBaseModel.code!.count > 0 { 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,6 +178,10 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele
178 } 178 }
179 self.playVideo(at: indexPath) 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 NotificationCenter.default.addObserver(self, selector: #selector(removePlayerAction), name: Notification.Name.PlayerManage.kPlayerDestroyNotification, object: nil) 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,6 +105,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD
105 return array 105 return array
106 }() 106 }()
107 107
  108 + var isReset: Bool! = false
108 var total_hd: Int! = 0 109 var total_hd: Int! = 0
109 var videoId: String! 110 var videoId: String!
110 var contentSid: String! 111 var contentSid: String!
@@ -153,6 +154,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD @@ -153,6 +154,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD
153 func addRefreshView() { 154 func addRefreshView() {
154 let headerRefreshView: CNLiveHeaderRefresh = CNLiveHeaderRefresh(refreshingBlock: { [weak self] in 155 let headerRefreshView: CNLiveHeaderRefresh = CNLiveHeaderRefresh(refreshingBlock: { [weak self] in
155 guard let self = self else { return } 156 guard let self = self else { return }
  157 + self.isReset = true
156 self.pageNum = 0 158 self.pageNum = 0
157 self.requestDataSource() 159 self.requestDataSource()
158 }) 160 })
@@ -274,7 +276,7 @@ extension CNLiveShortVideoCommentListView { @@ -274,7 +276,7 @@ extension CNLiveShortVideoCommentListView {
274 guard let cell = tableView.dequeueReusableCell(withIdentifier: kShortVideoCommentListTableViewCellIdentifier) as? CNLiveShortVideoCommentListTableViewCell else { 276 guard let cell = tableView.dequeueReusableCell(withIdentifier: kShortVideoCommentListTableViewCellIdentifier) as? CNLiveShortVideoCommentListTableViewCell else {
275 return CNLiveShortVideoCommentListTableViewCell() 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 cell.reloadRowBlock = {[weak self] viewCell, cell_h in 280 cell.reloadRowBlock = {[weak self] viewCell, cell_h in
279 guard let self = self else { return } 281 guard let self = self else { return }
280 let commentModel_temp = self.dataArray[viewCell.indexPath_current.row] as! ShortVideoHomeCommentListModel 282 let commentModel_temp = self.dataArray[viewCell.indexPath_current.row] as! ShortVideoHomeCommentListModel
@@ -533,10 +535,8 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel @@ -533,10 +535,8 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel
533 contentView.addSubview(tableView) 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 dataSource.addObjects(from: replyData.replys) 540 dataSource.addObjects(from: replyData.replys)
541 tableView_height = tableView_h 541 tableView_height = tableView_h
542 indexPath_current = indexPath 542 indexPath_current = indexPath
@@ -574,6 +574,7 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel @@ -574,6 +574,7 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel
574 make.right.equalToSuperview().offset(-10) 574 make.right.equalToSuperview().offset(-10)
575 make.height.equalTo(commentData.nickLayout.textBoundingRect.size.height) 575 make.height.equalTo(commentData.nickLayout.textBoundingRect.size.height)
576 } 576 }
  577 + self.tableView.snp.removeConstraints()
577 self.tableView.removeFromSuperview() 578 self.tableView.removeFromSuperview()
578 if replyData.replyCount ?? 0 > 2 { 579 if replyData.replyCount ?? 0 > 2 {
579 self.contentView.addSubview(self.tableView) 580 self.contentView.addSubview(self.tableView)
metaCode/Classes/Main/VideoPage/View/CNLiveShortVideoControlView.swift
@@ -29,6 +29,7 @@ class CNLiveShortVideoControlView: UIView, ZFPlayerMediaControl { @@ -29,6 +29,7 @@ class CNLiveShortVideoControlView: UIView, ZFPlayerMediaControl {
29 return sliderView 29 return sliderView
30 }() 30 }()
31 31
  32 + var bufferComplete: Bool! = false
32 33
33 override init(frame: CGRect) { 34 override init(frame: CGRect) {
34 super.init(frame: frame) 35 super.init(frame: frame)
@@ -70,9 +71,8 @@ class CNLiveShortVideoControlView: UIView, ZFPlayerMediaControl { @@ -70,9 +71,8 @@ class CNLiveShortVideoControlView: UIView, ZFPlayerMediaControl {
70 required init?(coder: NSCoder) { 71 required init?(coder: NSCoder) {
71 fatalError("init(coder:) has not been implemented") 72 fatalError("init(coder:) has not been implemented")
72 } 73 }
73 -  
74 func videoPlayer(_ videoPlayer: ZFPlayerController, loadStateChanged state: ZFPlayerLoadState) { 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 self.sliderView.startAnimating() 76 self.sliderView.startAnimating()
77 } else { 77 } else {
78 self.sliderView.stopAnimating() 78 self.sliderView.stopAnimating()
@@ -86,6 +86,21 @@ class CNLiveShortVideoControlView: UIView, ZFPlayerMediaControl { @@ -86,6 +86,21 @@ class CNLiveShortVideoControlView: UIView, ZFPlayerMediaControl {
86 func videoPlayer(_ videoPlayer: ZFPlayerController, bufferTime: TimeInterval) { 86 func videoPlayer(_ videoPlayer: ZFPlayerController, bufferTime: TimeInterval) {
87 self.sliderView.bufferValue = videoPlayer.bufferProgress 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 func gestureSingleTapped(_ gestureControl: ZFPlayerGestureControl) { 105 func gestureSingleTapped(_ gestureControl: ZFPlayerGestureControl) {
91 if (self.player?.currentPlayerManager.isPlaying == true) { 106 if (self.player?.currentPlayerManager.isPlaying == true) {