1. 优化首页语言的播放效果
2. 优化首页收藏行为后,收藏列表的更新效果 3. 修复充值时的 crash
This commit is contained in:
@@ -19,8 +19,10 @@ class UserPayViewController: BaseViewController, HiddenNavigationBarProtocol{
|
||||
}
|
||||
|
||||
func requestData(){
|
||||
RequestGet(path: "chargeprod/list", parma: ["channelType":"8"]) { data in
|
||||
|
||||
RequestGet(path: "chargeprod/list", parma: ["channelType":"8"]) { [weak self] data in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
if let list = Deserialized<UserPayViewModel>.toArray(with: data) {
|
||||
for (i,view) in self.viewList.enumerated() {
|
||||
if i < list.count{
|
||||
@@ -31,15 +33,15 @@ class UserPayViewController: BaseViewController, HiddenNavigationBarProtocol{
|
||||
}else{
|
||||
view.isHidden = true
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} fail: { code, data in
|
||||
print(code)
|
||||
}
|
||||
RequestGet(path: "purse/query", parma: ["channelType":"8"]) { data in
|
||||
|
||||
RequestGet(path: "purse/query", parma: ["channelType":"8"]) { [weak self] data in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
if let model = Deserialized<UserPayViewModel>.toModel(with: data) {
|
||||
self.pricView.text = model.diamonds
|
||||
}
|
||||
@@ -160,6 +162,7 @@ class UserPayViewController: BaseViewController, HiddenNavigationBarProtocol{
|
||||
let y = publishBtn.y + publishBtn.frame.height
|
||||
self.scrollView.contentSize = CGSize(width: ScreenWidth, height: y)
|
||||
}
|
||||
|
||||
@objc func publishBtnAction(){
|
||||
guard let chargeProdId = self.chooseModel?.chargeProdId else{
|
||||
return
|
||||
@@ -169,65 +172,65 @@ class UserPayViewController: BaseViewController, HiddenNavigationBarProtocol{
|
||||
let ticket = AuthManager.ticket
|
||||
let deviceInfo = UIDevice.current.identifierForVendor?.uuidString ?? ""
|
||||
let clientIp = "0.0.0.0"
|
||||
RequestPost(path: "storeKitV2/placeOrder", parma: ["chargeProdId":chargeProdId,"uid":uid,"ticket":ticket,"deviceInfo":deviceInfo]) { data in
|
||||
|
||||
|
||||
RequestPost(path: "storeKitV2/placeOrder", parma: ["chargeProdId":chargeProdId,"uid":uid,"ticket":ticket,"deviceInfo":deviceInfo]) { [weak self] data in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
if let _data = data as? [String:Any],let recordId = _data["recordId"] as? String,let appAccountToken = _data["appAccountToken"] as? String{
|
||||
self.initiatePaymentAction(recordId: recordId, appAccountToken: appAccountToken)
|
||||
}else{
|
||||
HUDTool.show(with: "购买失败")
|
||||
MBProgressHUD.hide(for: keyWindow, animated: true)
|
||||
}
|
||||
|
||||
|
||||
} fail: { code, data in
|
||||
HUDTool.show(with: data)
|
||||
MBProgressHUD.hide(for: keyWindow, animated: true)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
deinit{
|
||||
NotificationCenter.default.removeObserver(self)
|
||||
}
|
||||
|
||||
func initiatePaymentAction(recordId:String,appAccountToken:String) {
|
||||
self.orderId = recordId
|
||||
if #available(iOS 15.0, *) {
|
||||
UserPayViewManager.shared._ConditionBlock = {[weak self] (state , result) in
|
||||
if state == .Pay || state == .Start || state == .VerifiedServer{
|
||||
ScreenWidth
|
||||
}else if state == .Unowned{
|
||||
HUDTool.show(with: "出现未知错误,请重新尝试")
|
||||
MBProgressHUD.hide(for: keyWindow , animated: true)
|
||||
}else{
|
||||
HUDTool.show(with: "购买失败")
|
||||
MBProgressHUD.hide(for: keyWindow, animated: true)
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
if state == .VerifiedServer{
|
||||
|
||||
|
||||
if let data = result,let transactionId = data["transactionId"]{
|
||||
self?.paySuccess(transactionId:"\(transactionId)")
|
||||
DispatchQueue.main.async {
|
||||
if state == .Pay || state == .Start || state == .VerifiedServer{
|
||||
// ScreenWidth
|
||||
}else if state == .Unowned{
|
||||
HUDTool.show(with: "出现未知错误,请重新尝试")
|
||||
MBProgressHUD.hide(for: keyWindow , animated: true)
|
||||
}else{
|
||||
HUDTool.show(with: "购买失败")
|
||||
MBProgressHUD.hide(for: keyWindow, animated: true)
|
||||
}
|
||||
if state == .VerifiedServer{
|
||||
if let data = result,let transactionId = data["transactionId"]{
|
||||
self.paySuccess(transactionId:"\(transactionId)")
|
||||
}else{
|
||||
HUDTool.show(with: "购买失败")
|
||||
MBProgressHUD.hide(for: keyWindow, animated: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Task {
|
||||
do {
|
||||
try await UserPayViewManager.shared._demandCommodityThing(productId: self.chooseModel?.chargeProdId ?? "", uuid: appAccountToken)
|
||||
|
||||
}catch{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
HUDTool.show(with: "充值失败。当前仅支持运行iOS15及以上系统的手机进行充值,请升级系统版本后重试。")
|
||||
}
|
||||
}
|
||||
|
||||
func paySuccess(transactionId:String){
|
||||
let uid = "\(AuthManager.userUid)"
|
||||
let ticket = AuthManager.ticket
|
||||
@@ -236,33 +239,28 @@ class UserPayViewController: BaseViewController, HiddenNavigationBarProtocol{
|
||||
|
||||
if #available(iOS 15.0, *) {
|
||||
Task {
|
||||
try await UserPayViewManager.shared._verifyBusinessAccomplish(transaction: transactionId)
|
||||
await UserPayViewManager.shared._verifyBusinessAccomplish(transaction: transactionId)
|
||||
self.orderId = ""
|
||||
RequestGet(path: "purse/query", parma: ["channelType":"8"]) { data in
|
||||
|
||||
RequestGet(path: "purse/query", parma: ["channelType":"8"]) { [weak self] data in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
if let model = Deserialized<UserPayViewModel>.toModel(with: data) {
|
||||
self.pricView.text = model.diamonds
|
||||
}
|
||||
|
||||
} fail: { code, data in
|
||||
print(code)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} fail: { code, data in
|
||||
if code == 1444{
|
||||
Task {
|
||||
if #available(iOS 15.0, *) {
|
||||
try await UserPayViewManager.shared._verifyBusinessAccomplish(transaction: transactionId)
|
||||
await UserPayViewManager.shared._verifyBusinessAccomplish(transaction: transactionId)
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
HUDTool.show(with: data)
|
||||
|
Reference in New Issue
Block a user