34 lines
1.2 KiB
Go
34 lines
1.2 KiB
Go
// Package admin_system_menu 定义菜单路由接口(当前管理员可见菜单树),路由前缀 /admin。
|
|
package admin_system_menu
|
|
|
|
import "github.com/gogf/gf/v2/frame/g"
|
|
|
|
// RouteMeta 与 vben 后台动态路由元数据对应。
|
|
type RouteMeta struct {
|
|
Title string `json:"title"`
|
|
Icon string `json:"icon"`
|
|
Order int `json:"order"`
|
|
Authority []string `json:"authority,omitempty"` // 角色码
|
|
HideInMenu bool `json:"hideInMenu,omitempty"`
|
|
KeepAlive bool `json:"keepAlive,omitempty"`
|
|
}
|
|
|
|
// RouteItem vben 路由树中的一个节点。
|
|
type RouteItem struct {
|
|
Name string `json:"name"`
|
|
Path string `json:"path"`
|
|
Component string `json:"component,omitempty"`
|
|
Meta RouteMeta `json:"meta"`
|
|
Children []*RouteItem `json:"children,omitempty"`
|
|
}
|
|
|
|
// MenuRoutesReq 获取当前管理员的菜单树(后端鉴权模式,登录后即可访问)。
|
|
type MenuRoutesReq struct {
|
|
g.Meta `path:"/system/menu/routes" method:"post" tags:"Admin/System/Menu" summary:"当前管理员菜单路由"`
|
|
}
|
|
|
|
// MenuRoutesRes 是 MenuRoutesReq 的响应。
|
|
type MenuRoutesRes struct {
|
|
Routes []*RouteItem `json:"routes"`
|
|
}
|