Browse Source

【会员系统】补充撤销注销申请流程

wanjun 4 months ago
parent
commit
c3832a82df

+ 5 - 1
PDF Office/PDF Master/MemberCenter/ViewController/KMUserInfoViewController.swift

@@ -101,7 +101,11 @@ class KMUserInfoViewController: NSViewController {
         buyNow3Label.stringValue = NSLocalizedString("Upgrade", tableName: "MemberCenterLocalizable", comment: "")
         accountLabel.stringValue = NSLocalizedString("Account Center", tableName: "MemberCenterLocalizable", comment: "")
         signOutLabel.stringValue = NSLocalizedString("Sign out", tableName: "MemberCenterLocalizable", comment: "")
-        closeAccountLabel.stringValue = NSLocalizedString("Close account", tableName: "MemberCenterLocalizable", comment: "")
+        if KMMemberInfo.shared.validFlag == "5" {
+            closeAccountLabel.stringValue = NSLocalizedString("撤销注销账户", tableName: "MemberCenterLocalizable", comment: "")
+        } else {
+            closeAccountLabel.stringValue = NSLocalizedString("Close account", tableName: "MemberCenterLocalizable", comment: "")
+        }
         if userState == .unPay_UnTrial {
             number1Label.stringValue = NSLocalizedString("150+", tableName: "MemberCenterLocalizable", comment: "")
             number2Label.stringValue = NSLocalizedString("Benefits of functions", tableName: "MemberCenterLocalizable", comment: "")

+ 25 - 7
PDF Office/PDF Master/MemberCenter/ViewModel/KMUserInfoVCModel.swift

@@ -102,14 +102,32 @@ class KMUserInfoVCModel: ObservableObject {
      @abstract 注销账户;
      */
     func closeAccountAction() -> Void {
-        if KMMemberInfo.shared.vip_status == 1 {
-            NotificationCenter.default.post(name: NSNotification.Name("CloseMenuNotification"), object: nil)
-            KMMemberPromptWC.shared.tipType = .unsubscribe
-            KMMemberPromptWC.shared.showWindow(nil)
+        if KMMemberInfo.shared.validFlag == "5" {
+            // 撤销注销申请
+            KMMemberCenterManager.manager.userRevokeCancel { success, result in
+                guard let result = result else { return }
+                let resultDict = result as KMMemberCenterResult
+                let msg = resultDict.msg
+                if success {
+                    self.refreshUserInfo { success, msg in
+                        // 撤销注销申请后刷新用户数据
+                    }
+                } else {
+                    print(msg as Any)
+                }
+            }
         } else {
-            NotificationCenter.default.post(name: NSNotification.Name("CloseMenuNotification"), object: nil)
-            KMMemberPromptWC.shared.tipType = .signout
-            KMMemberPromptWC.shared.showWindow(nil)
+            if KMMemberInfo.shared.vip_status == 1 {
+                // 订阅用户提示退订
+                NotificationCenter.default.post(name: NSNotification.Name("CloseMenuNotification"), object: nil)
+                KMMemberPromptWC.shared.tipType = .unsubscribe
+                KMMemberPromptWC.shared.showWindow(nil)
+            } else {
+                // 手动注销
+                NotificationCenter.default.post(name: NSNotification.Name("CloseMenuNotification"), object: nil)
+                KMMemberPromptWC.shared.tipType = .signout
+                KMMemberPromptWC.shared.showWindow(nil)
+            }
         }
     }