webman迁移-优化
This commit is contained in:
@@ -405,7 +405,7 @@ if (!function_exists('get_controller_list')) {
|
||||
function get_controller_list(string $app = 'admin'): array
|
||||
{
|
||||
$controllerDir = root_path() . 'app' . DIRECTORY_SEPARATOR . $app . DIRECTORY_SEPARATOR . 'controller' . DIRECTORY_SEPARATOR;
|
||||
return class_exists(\ba\Filesystem::class)
|
||||
return (class_exists(\ba\Filesystem::class) && is_dir($controllerDir))
|
||||
? \ba\Filesystem::getDirFiles($controllerDir)
|
||||
: [];
|
||||
}
|
||||
@@ -414,6 +414,7 @@ if (!function_exists('get_controller_list')) {
|
||||
if (!function_exists('get_route_remark')) {
|
||||
/**
|
||||
* 获取当前路由后台菜单规则的备注信息
|
||||
* 使用控制器 domain 翻译,以支持不同控制器对同一 key(如 Remark lang)的不同翻译
|
||||
*/
|
||||
function get_route_remark(): string
|
||||
{
|
||||
@@ -435,7 +436,11 @@ if (!function_exists('get_route_remark')) {
|
||||
$remark = \support\think\Db::name('admin_rule')
|
||||
->where('name', 'in', $names)
|
||||
->value('remark');
|
||||
return __((string) ($remark ?? ''));
|
||||
$remarkStr = (string) ($remark ?? '');
|
||||
if (!$remarkStr) {
|
||||
return '';
|
||||
}
|
||||
return function_exists('trans') ? trans($remarkStr, [], $controllerPath ?: null) : $remarkStr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user