浏览代码

【会员系统】token过期相关问题

dinglingui 6 天之前
父节点
当前提交
14dcda72a4

+ 13 - 3
PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AIHeaderView/AIHeaderView.swift

@@ -52,10 +52,21 @@ class AIHeaderView: NSView, NibLoadable {
     
     //MARK: IBAction
     @IBAction func creditInfoAction(_ sender: NSButton) {
-       
         AIInfoManager.default().fetchAIInfo { dict, error in
             
         }
+        if(KMMemberInfo.shared.isLogin == true) {
+            KMUserInfoViewController.refreshTokenUserInfo {[weak self] success in
+                if(success == true) {
+                    self?.enterAIInfo()
+                }
+            }
+        } else  {
+            enterAIInfo()
+        }
+    }
+    
+    func enterAIInfo() {
         
         KMUserInfoVCModel().refreshUserInfo { success, msg in
             NotificationCenter.default.post(name: NSNotification.Name(rawValue: kDeviceAIStatusChangeNotification), object: nil)
@@ -100,7 +111,6 @@ class AIHeaderView: NSView, NibLoadable {
         popover.contentViewController = controller
         popover.behavior = .transient
         popover.show(relativeTo: sender.bounds, of: sender, preferredEdge: .minY)
-        
-        
+    
     }
 }

+ 16 - 8
PDF Office/PDF Master/Class/Purchase/DMG/Verification/KMVerificationMessageViewController.m

@@ -545,14 +545,22 @@ NSPopoverDelegate>
 }
 
 - (IBAction)personalCenterAction:(NSButton *)sender {
-    // 用户头像点击事件
-    self.userMenu = [[NSMenu alloc] init];
-    KMUserInfoViewController *userInfo = [[KMUserInfoViewController alloc] init];
-    NSMenuItem *item = [self.userMenu addItemWithTitle:@"" action:nil target:@""];
-    item.target = self;
-    item.representedObject = userInfo;
-    item.view = userInfo.view;
-    [self.userMenu popUpMenuPositioningItem:nil atLocation:NSMakePoint(-130, 30) inView:sender];
+    [KMUserInfoViewController refreshTokenUserInfoWithCallback:^(BOOL success) {
+        if(success) {
+            if([KMMemberInfo shared].isLogin == YES) {
+                // 用户头像点击事件
+                self.userMenu = [[NSMenu alloc] init];
+                KMUserInfoViewController *userInfo = [[KMUserInfoViewController alloc] init];
+                NSMenuItem *item = [self.userMenu addItemWithTitle:@"" action:nil target:@""];
+                item.target = self;
+                item.representedObject = userInfo;
+                item.view = userInfo.view;
+                [self.userMenu popUpMenuPositioningItem:nil atLocation:NSMakePoint(-130, 30) inView:sender];
+            }
+        }
+    }];
+  
+
 }
 
 - (IBAction)signUpAction:(NSButton *)sender {