- 将 admin 相关服务移动到 internal/service/admin 目录下 - 更新控制器中的服务导入路径引用 - 移除已合并的服务文件 - 添加统一工作约定文档 - 更新 API 接口定义的包路径
78 lines
2.6 KiB
Go
78 lines
2.6 KiB
Go
package menu_manage
|
|
|
|
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{}
|