- api/admin/v1 拆 base/system/admin 三子包,路由前缀 /admin/v1/{base,system,admin}
- system: auth/menu/role;admin: 管理员;base: log
- controller 改 import 子包;006_menu_paths_v2.sql 更新接口路径映射
- 权限码与路由分离,permission 标识不变
- 冒烟测试新路径 8 接口全通过
78 lines
2.6 KiB
Go
78 lines
2.6 KiB
Go
package system
|
|
|
|
import "github.com/gogf/gf/v2/frame/g"
|
|
|
|
// MenuItem is one node of the full menu tree (type 1 menu / 2 button).
|
|
type MenuItem struct {
|
|
Id uint64 `json:"id"`
|
|
ParentId uint64 `json:"parentId"`
|
|
Name string `json:"name"`
|
|
Icon string `json:"icon"`
|
|
Type int `json:"type"` // 1 menu, 2 button/api
|
|
Path string `json:"path"`
|
|
Component string `json:"component"`
|
|
Permission string `json:"permission"`
|
|
Sort int `json:"sort"`
|
|
Status int `json:"status"`
|
|
Hidden bool `json:"hidden"`
|
|
Children []*MenuItem `json:"children,omitempty"`
|
|
}
|
|
|
|
// MenuTreeReq returns the full menu tree for management.
|
|
type MenuTreeReq struct {
|
|
g.Meta `path:"/system/menu/tree" method:"get" tags:"Admin/System/Menu" summary:"Full menu tree"`
|
|
}
|
|
|
|
// MenuTreeRes is the response of MenuTreeReq.
|
|
type MenuTreeRes struct {
|
|
Tree []*MenuItem `json:"tree"`
|
|
}
|
|
|
|
// MenuCreateReq creates a menu or button node.
|
|
type MenuCreateReq struct {
|
|
g.Meta `path:"/system/menu" method:"post" tags:"Admin/System/Menu" summary:"Create menu"`
|
|
ParentId uint64 `json:"parentId"`
|
|
Name string `json:"name" v:"required"`
|
|
Icon string `json:"icon"`
|
|
Type int `json:"type" v:"in:1,2#type must be 1 or 2"`
|
|
Path string `json:"path"`
|
|
Component string `json:"component"`
|
|
Permission string `json:"permission" v:"required"`
|
|
Sort int `json:"sort"`
|
|
Status int `json:"status"`
|
|
Hidden bool `json:"hidden"`
|
|
}
|
|
|
|
// MenuCreateRes is the response of MenuCreateReq.
|
|
type MenuCreateRes struct {
|
|
Id uint64 `json:"id"`
|
|
}
|
|
|
|
// MenuUpdateReq updates a menu or button node.
|
|
type MenuUpdateReq struct {
|
|
g.Meta `path:"/system/menu/{id}" method:"put" tags:"Admin/System/Menu" summary:"Update menu"`
|
|
Id uint64 `json:"id" in:"path" v:"required"`
|
|
ParentId uint64 `json:"parentId"`
|
|
Name string `json:"name" v:"required"`
|
|
Icon string `json:"icon"`
|
|
Type int `json:"type" v:"in:1,2#type must be 1 or 2"`
|
|
Path string `json:"path"`
|
|
Component string `json:"component"`
|
|
Permission string `json:"permission" v:"required"`
|
|
Sort int `json:"sort"`
|
|
Status int `json:"status"`
|
|
Hidden bool `json:"hidden"`
|
|
}
|
|
|
|
// MenuUpdateRes is the response of MenuUpdateReq.
|
|
type MenuUpdateRes struct{}
|
|
|
|
// MenuDeleteReq deletes a menu node (soft delete).
|
|
type MenuDeleteReq struct {
|
|
g.Meta `path:"/system/menu/{id}" method:"delete" tags:"Admin/System/Menu" summary:"Delete menu"`
|
|
Id uint64 `json:"id" in:"path" v:"required"`
|
|
}
|
|
|
|
// MenuDeleteRes is the response of MenuDeleteReq.
|
|
type MenuDeleteRes struct{}
|