webman迁移-优化

This commit is contained in:
2026-03-18 15:10:40 +08:00
parent ea77c7b3a1
commit e2ae55319e
70 changed files with 1278 additions and 137 deletions

View File

@@ -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;
}
}