feat(admin): 管理首页标题修正、角色中文显示及用户总数补全

- 修正 admin layout title 后缀为「MetaLab 管理面板」
- 当前角色从原始字符串改为中文显示(注入 RoleDisplayName)
- 补全管理首页「用户总数」统计,新增 CountUsers 方法
- 遵循 ISP 最小接口,Service 复用已有 CountSearchUsers
This commit is contained in:
2026-05-26 23:21:32 +08:00
parent 403202be2b
commit 3937945b43
6 changed files with 21 additions and 5 deletions

View File

@ -36,6 +36,11 @@ func BuildAdminPageData(c *gin.Context, extra gin.H) gin.H {
if role, exists := c.Get("role"); exists {
roleStr := role.(string)
data["Role"] = roleStr
if name, ok := model.RoleDisplayNames[roleStr]; ok {
data["RoleDisplayName"] = name
} else {
data["RoleDisplayName"] = roleStr
}
data["CanManageUsers"] = model.HasMinRole(roleStr, model.RoleAdmin)
data["CanManageSettings"] = model.HasMinRole(roleStr, model.RoleOwner)
data["IsOwner"] = model.HasMinRole(roleStr, model.RoleOwner)