修改缓存方式
This commit is contained in:
@@ -277,7 +277,30 @@ class Auth extends \ba\Auth
|
||||
|
||||
public function getMenus(int $uid = 0): array
|
||||
{
|
||||
return parent::getMenus($uid ?: $this->id);
|
||||
$menus = parent::getMenus($uid ?: $this->id);
|
||||
|
||||
return $this->translateMenuRuleTitles($menus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 admin_rule.title(库内中文等)按当前请求语言翻译,供侧边栏/标签与 meta.title 一致。
|
||||
* 英文词条见 app/common/lang/en/admin_rule_title.php
|
||||
*
|
||||
* @param array<int, array<string, mixed>> $menus
|
||||
* @return array<int, array<string, mixed>>
|
||||
*/
|
||||
private function translateMenuRuleTitles(array $menus): array
|
||||
{
|
||||
foreach ($menus as $k => $item) {
|
||||
if (isset($item['title']) && is_string($item['title']) && $item['title'] !== '') {
|
||||
$menus[$k]['title'] = __($item['title']);
|
||||
}
|
||||
if (!empty($item['children']) && is_array($item['children'])) {
|
||||
$menus[$k]['children'] = $this->translateMenuRuleTitles($item['children']);
|
||||
}
|
||||
}
|
||||
|
||||
return $menus;
|
||||
}
|
||||
|
||||
public function isSuperAdmin(): bool
|
||||
|
||||
Reference in New Issue
Block a user