Explorar el Código

【综合】Restore弹窗限制

tangchao hace 5 días
padre
commit
e095f50e70

+ 28 - 1
PDF Office/PDF Master/MemberCenter/WindowsController/KMProductCompareWC.swift

@@ -319,6 +319,9 @@ class KMProductCompareWC: NSWindowController {
 
     @objc override func showWindow(_ sender: Any?) {
         super.showWindow(sender)
+        
+        alertingCodeForRefreshUserInfo_ = nil
+        alertingForRefreshUserInfo_ = false
 #if VERSION_DMG
         model.getDMGProductDatas { success, result in
             
@@ -1106,10 +1109,34 @@ class KMProductCompareWC: NSWindowController {
         alert.runModal()
     }
 
+    private var alertingForRefreshUserInfo_ = false
+    private var alertingCodeForRefreshUserInfo_: Int?
     private func handleVerificationFailure(msg: KMMemberProductResult?) {
+        if self.alertingForRefreshUserInfo_ {
+            KMPrint("刷新用户信息-Alert中。。。")
+            return
+        }
+        
+        if msg?.code == 500 {
+            KMPrint("错误信息: One record is expected, but the query result is multiple records。。。")
+            return
+        }
+        
+        if msg?.code == alertingCodeForRefreshUserInfo_ {
+            KMPrint("刷新用户信息-Alert中 重复Code 。。。")
+            return
+        }
+        
         var message = msg?.msg ?? ""
         if !message.isEmpty {
-            KMMemberCenterManager.quickShowAlert(result: msg, callback: nil)
+            alertingForRefreshUserInfo_ = true
+            alertingCodeForRefreshUserInfo_ = msg?.code
+            KMMemberCenterManager.showAlert(code: .init(rawValue: msg?.code ?? 0), message: msg?.msg) { [weak self] resp, _ in
+                DispatchQueue.main.async {
+                    self?.alertingForRefreshUserInfo_ = false
+//                    self?.alertingCodeForRefreshUserInfo_ = nil
+                }
+            }
         }
     }