zzb 1 éve
szülő
commit
c7d8f0efc6
1 módosított fájl, 4 hozzáadás és 10 törlés
  1. 4 10
      app/api/controller/base/Permissions.php

+ 4 - 10
app/api/controller/base/Permissions.php

@@ -55,26 +55,20 @@ class Permissions extends Base
 
             $arr = (array)$decoded;
             if (!isset($arr['exp']) || $arr['exp'] < time()) {
-                self::clear_session();
-                throw new \think\Exception('登入超时,请重新登录');
+                throw new \think\Exception('Expired token');
             } else {
                 //鉴权成功
                 $this->userId = $arr['data']->userId;
                 $loginTime = $arr['data']->loginTime;
                 $exptime = $arr['exp'];
-                //限制账号多次登入
-//                if ($this->getUser()->getData('login_time') > $loginTime) {
-//                    $this->clear_session();
-//                    throw new \think\Exception('您的账号已经在其它地方登入');
-//                }
                 // 每次刷新jwt,loginTime要保持不变
                 self::createJwt($this->userId, $loginTime, 3600, $exptime);
                 return;
             }
         } catch (Exception $e) {
-            if ($e instanceof HttpResponseException) {
-                $this->json_error($e->getResponse()->getData()['msg']);
-            }
+//            if ($e instanceof HttpResponseException) {
+//                $this->json_error($e->getResponse()->getData()['msg']);
+//            }
             switch ($e->getMessage()) {
                 case "Expired token":
                     self::clear_session();