修改路由加载
This commit is contained in:
parent
0d05e4ecbd
commit
aea9eb6a17
@ -244,17 +244,15 @@ class CatchAdmin
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @time 2019年11月30日
|
* @time 2019年11月30日
|
||||||
* @return string
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function getRoutes(): string
|
public static function getRoutes()
|
||||||
{
|
{
|
||||||
if (file_exists(self::getCacheRoutesFile())) {
|
if (file_exists(self::getCacheRoutesFile())) {
|
||||||
return self::getCacheRoutesFile();
|
return self::getCacheRoutesFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
self::cacheRoutes();
|
return self::getModuleRoutes();
|
||||||
|
|
||||||
return self::getCacheRoutesFile();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -271,6 +269,24 @@ class CatchAdmin
|
|||||||
return self::getModuleViews();
|
return self::getModuleViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @time 2019年12月15日
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getModuleRoutes(): array
|
||||||
|
{
|
||||||
|
$routeFiles = [];
|
||||||
|
foreach (self::getModulesDirectory() as $module) {
|
||||||
|
$moduleInfo = self::getModuleInfo($module);
|
||||||
|
if (!in_array($moduleInfo['alias'], ['login']) && file_exists($module . 'route.php')) {
|
||||||
|
$routeFiles[] = $module . 'route.php';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $routeFiles;
|
||||||
|
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @time 2019年11月30日
|
* @time 2019年11月30日
|
||||||
@ -278,17 +294,9 @@ class CatchAdmin
|
|||||||
*/
|
*/
|
||||||
public static function cacheRoutes()
|
public static function cacheRoutes()
|
||||||
{
|
{
|
||||||
$routeFiles = [];
|
|
||||||
foreach (self::getModulesDirectory() as $module) {
|
|
||||||
$moduleInfo = self::getModuleInfo($module);
|
|
||||||
if (!in_array($moduleInfo['alias'], ['login'])) {
|
|
||||||
if (file_exists($module . 'route.php')) {
|
|
||||||
$routeFiles[] = $module . 'route.php';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$routes = '';
|
$routes = '';
|
||||||
foreach ($routeFiles as $route) {
|
|
||||||
|
foreach (self::getModuleRoutes() as $route) {
|
||||||
$routes .= trim(str_replace('<?php', '', file_get_contents($route))) . PHP_EOL;
|
$routes .= trim(str_replace('<?php', '', file_get_contents($route))) . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,13 +25,15 @@ class LoadModuleRoutes
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getRoutes()
|
/**
|
||||||
|
*
|
||||||
|
* @time 2019年12月15日
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getRoutes(): array
|
||||||
{
|
{
|
||||||
return [
|
$routes = CatchAdmin::getRoutes();
|
||||||
CatchAdmin::directory() . 'login' . DIRECTORY_SEPARATOR . 'route.php',
|
$routes[] = CatchAdmin::directory() . 'login' . DIRECTORY_SEPARATOR . 'route.php';
|
||||||
CatchAdmin::getRoutes(),
|
return $routes;
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user