Commit 9787d06b64538e2c6360749965cbe4491f4e0f00

Authored by “张旭”
1 parent c44d078f

积分支付加取消状态

metaCode/Classes/Common/Util/CNLiveIntegralAlertTool.swift
@@ -21,6 +21,8 @@ enum CNLiveIntegralPayStatus { @@ -21,6 +21,8 @@ enum CNLiveIntegralPayStatus {
21 case paySuccess 21 case paySuccess
22 ///支付失败 22 ///支付失败
23 case payFailed 23 case payFailed
  24 + ///支付取消
  25 + case payCancel
24 26
25 } 27 }
26 typealias integralStatusChangeBlock = (_ integralPayStatus:CNLiveIntegralPayStatus) -> Void 28 typealias integralStatusChangeBlock = (_ integralPayStatus:CNLiveIntegralPayStatus) -> Void
@@ -28,7 +30,6 @@ typealias integralStatusChangeBlock = (_ integralPayStatus:CNLiveIntegralPayStat @@ -28,7 +30,6 @@ typealias integralStatusChangeBlock = (_ integralPayStatus:CNLiveIntegralPayStat
28 class CNLiveIntegralAlertTool:NSObject{ 30 class CNLiveIntegralAlertTool:NSObject{
29 static let shared = CNLiveIntegralAlertTool() 31 static let shared = CNLiveIntegralAlertTool()
30 32
31 - var homePageNeedReloadActionBlock:homePageNeedReloadBlockActionBlock?  
32 var integralStatusChangedBlock:integralStatusChangeBlock? 33 var integralStatusChangedBlock:integralStatusChangeBlock?
33 34
34 ///当前积分支付状态 35 ///当前积分支付状态
@@ -317,18 +318,24 @@ class CNLiveIntegralAlertTool:NSObject{ @@ -317,18 +318,24 @@ class CNLiveIntegralAlertTool:NSObject{
317 318
318 // MARK: - BtnAction 319 // MARK: - BtnAction
319 @objc func bgBtnViewAction(){ 320 @objc func bgBtnViewAction(){
  321 + self.currentIntegralPayStatus = .payCancel
  322 + self.initUI()
  323 + self.integralStatusChangedBlock!(.payCancel)
320 self.hiddenIntegralAlert() 324 self.hiddenIntegralAlert()
321 } 325 }
322 @objc func closeBtnAction(){ 326 @objc func closeBtnAction(){
  327 + self.currentIntegralPayStatus = .payCancel
  328 + self.initUI()
  329 + self.integralStatusChangedBlock!(.payCancel)
323 self.hiddenIntegralAlert() 330 self.hiddenIntegralAlert()
324 } 331 }
325 @objc func payBtnAction(){ 332 @objc func payBtnAction(){
326 if self.currentIntegralPayStatus == .integralEnough{ 333 if self.currentIntegralPayStatus == .integralEnough{
327 self.postOrderVideoByPoint() 334 self.postOrderVideoByPoint()
328 - self.integralStatusChangedBlock!(.integralEnough) 335 +// self.integralStatusChangedBlock!(self.currentIntegralPayStatus)
329 }else if self.currentIntegralPayStatus == .integralNotEnough{ 336 }else if self.currentIntegralPayStatus == .integralNotEnough{
330 self.hiddenIntegralAlert() 337 self.hiddenIntegralAlert()
331 - self.integralStatusChangedBlock!(.integralNotEnough) 338 +// self.integralStatusChangedBlock!(self.currentIntegralPayStatus)
332 //跳转任务中心 339 //跳转任务中心
333 navigationViewController().pushViewController(CNLiveMineQuestViewController(checkModel: self.checkInModel!), animated: pushAnimated) 340 navigationViewController().pushViewController(CNLiveMineQuestViewController(checkModel: self.checkInModel!), animated: pushAnimated)
334 341
@@ -347,7 +354,6 @@ class CNLiveIntegralAlertTool:NSObject{ @@ -347,7 +354,6 @@ class CNLiveIntegralAlertTool:NSObject{
347 // MARK: - 积分付费接口 354 // MARK: - 积分付费接口
348 func postOrderVideoByPoint(){ 355 func postOrderVideoByPoint(){
349 self.currentIntegralPayStatus = .paying 356 self.currentIntegralPayStatus = .paying
350 - self.integralStatusChangedBlock!(.paying)  
351 self.initUI() 357 self.initUI()
352 //付费接口 358 //付费接口
353 CNLiveHomePageViewModel.orderVideoByPoint(prdId: self.productId) { result, status in 359 CNLiveHomePageViewModel.orderVideoByPoint(prdId: self.productId) { result, status in
@@ -356,24 +362,24 @@ class CNLiveIntegralAlertTool:NSObject{ @@ -356,24 +362,24 @@ class CNLiveIntegralAlertTool:NSObject{
356 self.currentIntegralPayStatus = .paySuccess 362 self.currentIntegralPayStatus = .paySuccess
357 self.initUI() 363 self.initUI()
358 //刷新短剧首页数据 364 //刷新短剧首页数据
359 - self.homePageNeedReloadActionBlock!()  
360 self.integralStatusChangedBlock!(.paySuccess) 365 self.integralStatusChangedBlock!(.paySuccess)
361 }else{ 366 }else{
362 //购买失败 367 //购买失败
363 if self.point > Int(self.integralCount)!{ 368 if self.point > Int(self.integralCount)!{
364 //可以支付积分 369 //可以支付积分
365 self.currentIntegralPayStatus = .integralEnough 370 self.currentIntegralPayStatus = .integralEnough
  371 +// self.integralStatusChangedBlock!(.integralEnough)
  372 +
366 }else{ 373 }else{
367 //积分不足 374 //积分不足
368 self.currentIntegralPayStatus = .integralNotEnough 375 self.currentIntegralPayStatus = .integralNotEnough
  376 +// self.integralStatusChangedBlock!(.integralEnough)
369 } 377 }
370 self.initUI() 378 self.initUI()
371 let errMsg = result as! String 379 let errMsg = result as! String
372 showMessage(message: errMsg) 380 showMessage(message: errMsg)
373 - self.integralStatusChangedBlock!(.payFailed)  
374 } 381 }
375 } 382 }
376 -  
377 } 383 }
378 384
379 385
metaCode/Classes/Main/HomePages/View/PlayletHomePage/CNLivePlayletHomePageHeaderCell.swift
@@ -329,10 +329,12 @@ class CNLivePlayletHomePageHeaderCell:UITableViewCell{ @@ -329,10 +329,12 @@ class CNLivePlayletHomePageHeaderCell:UITableViewCell{
329 if self.albumListModel?.product?.check == false{ 329 if self.albumListModel?.product?.check == false{
330 //未购买->购买 330 //未购买->购买
331 CNLiveIntegralAlertTool.shared.showIntegralAlert(title: "\(self.albumListModel?.albumMsgModel?.albumName ?? "")共\(self.albumListModel?.albumMsgModel?.episodeNow ?? "1")集", integralCount: self.albumListModel?.albumMsgModel?.product?.point ?? "0", productId: self.albumListModel?.product?.productId ?? "") 331 CNLiveIntegralAlertTool.shared.showIntegralAlert(title: "\(self.albumListModel?.albumMsgModel?.albumName ?? "")共\(self.albumListModel?.albumMsgModel?.episodeNow ?? "1")集", integralCount: self.albumListModel?.albumMsgModel?.product?.point ?? "0", productId: self.albumListModel?.product?.productId ?? "")
332 - CNLiveIntegralAlertTool.shared.homePageNeedReloadActionBlock = {  
333 - self.homePageNeedReloadActionBlock!()  
334 - DispatchQueue.main.asyncAfter(deadline: .now()+1.5) { [self] in  
335 - self.followChangeStatus(isFollowed: true) 332 + CNLiveIntegralAlertTool.shared.integralStatusChangedBlock = { integralPayStatus in
  333 + if integralPayStatus == .paySuccess{
  334 + self.homePageNeedReloadActionBlock!()
  335 + DispatchQueue.main.asyncAfter(deadline: .now()+1.5) { [self] in
  336 + self.followChangeStatus(isFollowed: true)
  337 + }
336 } 338 }
337 } 339 }
338 } 340 }