优化数据归属问题
This commit is contained in:
@@ -251,9 +251,27 @@ class Rule extends Backend
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($rules as $idx => $rule) {
|
||||
$title = $rule['title'] ?? '';
|
||||
if (is_string($title) && $title !== '') {
|
||||
$rules[$idx]['title'] = $this->menuTitleToZh($title);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->assembleTree ? $this->tree->assembleChild($rules) : $rules;
|
||||
}
|
||||
|
||||
private function menuTitleToZh(string $title): string
|
||||
{
|
||||
static $zhMap = null;
|
||||
if (!is_array($zhMap)) {
|
||||
$mapFile = app_path() . '/common/lang/zh-cn/admin_rule_title.php';
|
||||
$loaded = is_file($mapFile) ? include $mapFile : [];
|
||||
$zhMap = is_array($loaded) ? $loaded : [];
|
||||
}
|
||||
return isset($zhMap[$title]) && is_string($zhMap[$title]) ? $zhMap[$title] : $title;
|
||||
}
|
||||
|
||||
private function autoAssignPermission(int $id, int $pid): void
|
||||
{
|
||||
$groups = AdminGroup::where('rules', '<>', '*')->select();
|
||||
|
||||
Reference in New Issue
Block a user