Commit 9787d06b64538e2c6360749965cbe4491f4e0f00
1 parent
c44d078f
积分支付加取消状态
Showing
2 changed files
with
19 additions
and
11 deletions
metaCode/Classes/Common/Util/CNLiveIntegralAlertTool.swift
| ... | ... | @@ -21,6 +21,8 @@ enum CNLiveIntegralPayStatus { |
| 21 | 21 | case paySuccess |
| 22 | 22 | ///支付失败 |
| 23 | 23 | case payFailed |
| 24 | + ///支付取消 | |
| 25 | + case payCancel | |
| 24 | 26 | |
| 25 | 27 | } |
| 26 | 28 | typealias integralStatusChangeBlock = (_ integralPayStatus:CNLiveIntegralPayStatus) -> Void |
| ... | ... | @@ -28,7 +30,6 @@ typealias integralStatusChangeBlock = (_ integralPayStatus:CNLiveIntegralPayStat |
| 28 | 30 | class CNLiveIntegralAlertTool:NSObject{ |
| 29 | 31 | static let shared = CNLiveIntegralAlertTool() |
| 30 | 32 | |
| 31 | - var homePageNeedReloadActionBlock:homePageNeedReloadBlockActionBlock? | |
| 32 | 33 | var integralStatusChangedBlock:integralStatusChangeBlock? |
| 33 | 34 | |
| 34 | 35 | ///当前积分支付状态 |
| ... | ... | @@ -317,18 +318,24 @@ class CNLiveIntegralAlertTool:NSObject{ |
| 317 | 318 | |
| 318 | 319 | // MARK: - BtnAction |
| 319 | 320 | @objc func bgBtnViewAction(){ |
| 321 | + self.currentIntegralPayStatus = .payCancel | |
| 322 | + self.initUI() | |
| 323 | + self.integralStatusChangedBlock!(.payCancel) | |
| 320 | 324 | self.hiddenIntegralAlert() |
| 321 | 325 | } |
| 322 | 326 | @objc func closeBtnAction(){ |
| 327 | + self.currentIntegralPayStatus = .payCancel | |
| 328 | + self.initUI() | |
| 329 | + self.integralStatusChangedBlock!(.payCancel) | |
| 323 | 330 | self.hiddenIntegralAlert() |
| 324 | 331 | } |
| 325 | 332 | @objc func payBtnAction(){ |
| 326 | 333 | if self.currentIntegralPayStatus == .integralEnough{ |
| 327 | 334 | self.postOrderVideoByPoint() |
| 328 | - self.integralStatusChangedBlock!(.integralEnough) | |
| 335 | +// self.integralStatusChangedBlock!(self.currentIntegralPayStatus) | |
| 329 | 336 | }else if self.currentIntegralPayStatus == .integralNotEnough{ |
| 330 | 337 | self.hiddenIntegralAlert() |
| 331 | - self.integralStatusChangedBlock!(.integralNotEnough) | |
| 338 | +// self.integralStatusChangedBlock!(self.currentIntegralPayStatus) | |
| 332 | 339 | //跳转任务中心 |
| 333 | 340 | navigationViewController().pushViewController(CNLiveMineQuestViewController(checkModel: self.checkInModel!), animated: pushAnimated) |
| 334 | 341 | |
| ... | ... | @@ -347,7 +354,6 @@ class CNLiveIntegralAlertTool:NSObject{ |
| 347 | 354 | // MARK: - 积分付费接口 |
| 348 | 355 | func postOrderVideoByPoint(){ |
| 349 | 356 | self.currentIntegralPayStatus = .paying |
| 350 | - self.integralStatusChangedBlock!(.paying) | |
| 351 | 357 | self.initUI() |
| 352 | 358 | //付费接口 |
| 353 | 359 | CNLiveHomePageViewModel.orderVideoByPoint(prdId: self.productId) { result, status in |
| ... | ... | @@ -356,24 +362,24 @@ class CNLiveIntegralAlertTool:NSObject{ |
| 356 | 362 | self.currentIntegralPayStatus = .paySuccess |
| 357 | 363 | self.initUI() |
| 358 | 364 | //刷新短剧首页数据 |
| 359 | - self.homePageNeedReloadActionBlock!() | |
| 360 | 365 | self.integralStatusChangedBlock!(.paySuccess) |
| 361 | 366 | }else{ |
| 362 | 367 | //购买失败 |
| 363 | 368 | if self.point > Int(self.integralCount)!{ |
| 364 | 369 | //可以支付积分 |
| 365 | 370 | self.currentIntegralPayStatus = .integralEnough |
| 371 | +// self.integralStatusChangedBlock!(.integralEnough) | |
| 372 | + | |
| 366 | 373 | }else{ |
| 367 | 374 | //积分不足 |
| 368 | 375 | self.currentIntegralPayStatus = .integralNotEnough |
| 376 | +// self.integralStatusChangedBlock!(.integralEnough) | |
| 369 | 377 | } |
| 370 | 378 | self.initUI() |
| 371 | 379 | let errMsg = result as! String |
| 372 | 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 | 329 | if self.albumListModel?.product?.check == false{ |
| 330 | 330 | //未购买->购买 |
| 331 | 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 | } | ... | ... |