Просмотр исходного кода

Merge remote-tracking branch 'origin/feat/bank_account' into dev

* origin/feat/bank_account:
  feat: 增加银行卡审核入口
陈文艺 23 часов назад
Родитель
Сommit
52038e8bfc

+ 6 - 0
Lanu/Assets.xcassets/Common/Security/Contents.json

@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 22 - 0
Lanu/Assets.xcassets/Common/Security/ic_security.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "ic_security@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "ic_security@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
Lanu/Assets.xcassets/Common/Security/ic_security.imageset/ic_security@2x.png


BIN
Lanu/Assets.xcassets/Common/Security/ic_security.imageset/ic_security@3x.png


+ 8 - 0
Lanu/Manager/Purchase/LNPurchaseManager.swift

@@ -165,6 +165,14 @@ extension LNPurchaseManager {
             }
         }
     }
+    
+    func getBankAccountStatus(queue: DispatchQueue = .main, handler: @escaping(LNBankAccountStatus?) -> Void) {
+        LNHttpManager.shared.getBankAccountStatus { res, err in
+            queue.asyncIfNotGlobal {
+                handler(res?.bankCardState)
+            }
+        }
+    }
 }
 
 extension LNPurchaseManager: LNAccountManagerNotify {

+ 6 - 0
Lanu/Manager/Purchase/Network/LNHttpManager+Purchase.swift

@@ -19,6 +19,8 @@ private let kNetPath_Purchase_Verify = "/wallet/recharge/goods/payBak"
 private let kNetPath_Purchase_Exchange = "/wallet/exchange"
 private let kNetPath_Purchase_Pre = "/wallet/exchange/pre"
 
+private let kNetPath_Purchase_Bank_Account = "/wallet/withdraw/getRealNameAuthStatus"
+
 
 extension LNHttpManager {
     func getWalletInfo(completion: @escaping (LNUserWalletInfoResponse?, LNHttpError?) -> Void) {
@@ -64,4 +66,8 @@ extension LNHttpManager {
             "amount": count
         ], completion: completion)
     }
+    
+    func getBankAccountStatus(completion: @escaping(LNBankAccountStatusResponse?, LNHttpError?) -> Void) {
+        post(path: kNetPath_Purchase_Bank_Account, completion: completion)
+    }
 }

+ 12 - 0
Lanu/Manager/Purchase/Network/LNPurchaseResponse.swift

@@ -84,3 +84,15 @@ class LNPurchaseCreateOrderResponse: Decodable {
 class LNExchangeExpectResponse: Decodable {
     var amount: Double = 0.0
 }
+
+enum LNBankAccountStatus: Int, Decodable {
+    case none
+    case reviewing
+    case done
+    case notPass
+}
+
+@AutoCodable
+class LNBankAccountStatusResponse: Decodable {
+    var bankCardState: LNBankAccountStatus = .none
+}

+ 18 - 0
Lanu/Views/Wallet/Bean/LNBeanViewController.swift

@@ -29,6 +29,7 @@ class LNBeanViewController: LNViewController {
         setupViews()
         
         updateContent()
+        loadBankStatus()
     }
     
     override func viewDidAppear(_ animated: Bool) {
@@ -38,6 +39,23 @@ class LNBeanViewController: LNViewController {
     }
 }
 
+extension LNBeanViewController {
+    private func loadBankStatus() {
+        guard myUserInfo.playmate, LNConfigManager.shared.isBeanAvailable else { return }
+        LNPurchaseManager.shared.getBankAccountStatus { [weak self] status in
+            guard let self else { return }
+            guard status == .done else { return }
+            let button = UIButton()
+            button.setImage(.icSecurity, for: .normal)
+            button.addAction(UIAction(handler: { [weak self] _ in
+                guard let self else { return }
+                view.pushToWebView(.init(url: .beanUrl))
+            }), for: .touchUpInside)
+            setRightButton(button)
+        }
+    }
+}
+
 extension LNBeanViewController: LNPurchaseManagerNotify {
     func onUserWalletInfoChanged(info: LNUserWalletInfo) {
         updateContent()