xieruidong 2 年之前
父节点
当前提交
facfaca666
共有 1 个文件被更改,包括 5 次插入5 次删除
  1. 5 5
      app/data/controller/api/Auth.php

+ 5 - 5
app/data/controller/api/Auth.php

@@ -69,11 +69,11 @@ abstract class Auth extends Controller
         try {
             if (empty($this->uuid)) {
                 $token = $this->request->header('api-token');
-                if(!in_array($this->app->request->action(),$this->getNoNeedLogin(),true)) {
+                if($this->NeedLogin()) {
                     if (empty($token)) $this->error('登录认证不能为空!');
                 }
                 [$state, $info, $this->uuid] = UserTokenService::check($this->type, $token);
-                if(!in_array($this->app->request->action(),$this->getNoNeedLogin(),true)) {
+                if($this->NeedLogin()) {
                     if (empty($state)) $this->error($info, '{-null-}', 401);
                 }
             }
@@ -100,10 +100,10 @@ abstract class Auth extends Controller
     }
 
     /**
-     * @return array
+     * @return bool
      */
-    public function getNoNeedLogin(): array
+    public function NeedLogin(): bool
     {
-        return $this->noNeedLogin;
+        return !in_array($this->app->request->action(),$this->noNeedLogin,true);
     }
 }