add:新增GET方法单独的认证标识

This commit is contained in:
JaguarJack
2020-10-12 12:22:05 +08:00
parent f17570deef
commit 3908c26e2c
3 changed files with 47 additions and 2 deletions

View File

@@ -119,6 +119,25 @@ class Utils
return [$module, $controllerName, $action];
}
/**
* get controller & action
*
* @time 2020年10月12日
* @param $rule
* @return false|string[]
* @throws \ReflectionException
*/
public static function isMethodNeedAuth($rule)
{
list($controller, $action) = explode(Str::contains($rule, '@') ? '@' : '/', $rule);
$docComment = (new \ReflectionClass($controller))->getMethod($action)->getDocComment();
return strpos($docComment, config('catch.permissions.method_auth_mark')) !== false;
}
/**
* 表前缀
*