初始化
缺陷:主题配色需要优化整体的同风格
This commit is contained in:
@@ -243,14 +243,20 @@ class UtilsService
|
||||
{
|
||||
foreach ($class as $key => $value) {
|
||||
|
||||
$reflection = new ReflectionClass($value);
|
||||
// 获取控制器$value的所有方法
|
||||
$methods = (new ReflectionClass($value))->getMethods();
|
||||
$methods = $reflection->getMethods();
|
||||
// 子类声明的排除清单:继承来的 CRUD 也会被反射到,不该暴露的在这里拦掉
|
||||
$exceptRoute = (array) ($reflection->getDefaultProperties()['exceptRoute'] ?? []);
|
||||
|
||||
// 注册路由
|
||||
foreach ($methods as $method) {
|
||||
// 获取方法注释 @Method
|
||||
$docComment = $method->getDocComment();
|
||||
if ($method->name === '__construct' || preg_match('/@Method\s+(NO)\b/', $docComment, $matches)) {
|
||||
if ($method->name === '__construct'
|
||||
|| in_array($method->name, $exceptRoute, true)
|
||||
|| preg_match('/@Method\s+(NO)\b/', (string) $docComment, $matches)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user