Some checks failed
Build and Deploy (service.xpcool.com) / build-and-deploy (push) Failing after 31s
将 api 层校验规则提示语、service 层 gerror.Wrap 与 response.Error 错误信息、panic 未注册提示统一改为中文,并同步中文化 cmd 路由注释 与变更记录。仅涉及注释、文档与字符串改动,无业务逻辑变更。
79 lines
2.8 KiB
Go
79 lines
2.8 KiB
Go
// Package admin_system_menu_manage 定义菜单管理接口(菜单 + 按钮权限树),路由前缀 /admin。
|
||
package admin_system_menu_manage
|
||
|
||
import "github.com/gogf/gf/v2/frame/g"
|
||
|
||
// MenuItem 完整菜单树中的一个节点(type 1 菜单 / 2 按钮)。
|
||
type MenuItem struct {
|
||
Id uint64 `json:"id"`
|
||
ParentId uint64 `json:"parentId"`
|
||
Name string `json:"name"`
|
||
Icon string `json:"icon"`
|
||
Type int `json:"type"` // 1 菜单, 2 按钮/接口
|
||
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 获取完整菜单树(供管理)。
|
||
type MenuTreeReq struct {
|
||
g.Meta `path:"/system/menu/tree" method:"post" tags:"Admin/System/Menu" summary:"完整菜单树"`
|
||
}
|
||
|
||
// MenuTreeRes 是 MenuTreeReq 的响应。
|
||
type MenuTreeRes struct {
|
||
Tree []*MenuItem `json:"tree"`
|
||
}
|
||
|
||
// MenuCreateReq 创建菜单或按钮节点。
|
||
type MenuCreateReq struct {
|
||
g.Meta `path:"/system/menu/create" method:"post" tags:"Admin/System/Menu" summary:"创建菜单"`
|
||
ParentId uint64 `json:"parentId"`
|
||
Name string `json:"name" v:"required"`
|
||
Icon string `json:"icon"`
|
||
Type int `json:"type" v:"in:1,2#类型必须为 1 或 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 是 MenuCreateReq 的响应。
|
||
type MenuCreateRes struct {
|
||
Id uint64 `json:"id"`
|
||
}
|
||
|
||
// MenuUpdateReq 更新菜单或按钮节点。
|
||
type MenuUpdateReq struct {
|
||
g.Meta `path:"/system/menu/update/{id}" method:"post" tags:"Admin/System/Menu" summary:"更新菜单"`
|
||
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#类型必须为 1 或 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 是 MenuUpdateReq 的响应。
|
||
type MenuUpdateRes struct{}
|
||
|
||
// MenuDeleteReq 删除菜单节点(软删除)。
|
||
type MenuDeleteReq struct {
|
||
g.Meta `path:"/system/menu/delete/{id}" method:"post" tags:"Admin/System/Menu" summary:"删除菜单"`
|
||
Id uint64 `json:"id" in:"path" v:"required"`
|
||
}
|
||
|
||
// MenuDeleteRes 是 MenuDeleteReq 的响应。
|
||
type MenuDeleteRes struct{}
|