- 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 接口全通过
63 lines
1.9 KiB
Go
63 lines
1.9 KiB
Go
package system
|
|
|
|
import "github.com/gogf/gf/v2/frame/g"
|
|
|
|
// RoleItem is one row of the role list.
|
|
type RoleItem struct {
|
|
Id uint64 `json:"id"`
|
|
Code string `json:"code"`
|
|
Name string `json:"name"`
|
|
Status int `json:"status"`
|
|
MenuIds []uint64 `json:"menuIds"` // bound menu ids (for editing)
|
|
CreatedAt string `json:"createdAt"`
|
|
}
|
|
|
|
// RoleListReq pages the roles.
|
|
type RoleListReq struct {
|
|
g.Meta `path:"/system/role" method:"get" tags:"Admin/System/Role" summary:"Role list"`
|
|
Page int `json:"page" d:"1" v:"min:1"`
|
|
Size int `json:"size" d:"10" v:"min:1|max:100"`
|
|
Keyword string `json:"keyword"` // matches code or name
|
|
}
|
|
|
|
// RoleListRes is the response of RoleListReq.
|
|
type RoleListRes struct {
|
|
List []*RoleItem `json:"list"`
|
|
Total int `json:"total"`
|
|
}
|
|
|
|
// RoleCreateReq creates a role and binds menu ids.
|
|
type RoleCreateReq struct {
|
|
g.Meta `path:"/system/role" method:"post" tags:"Admin/System/Role" summary:"Create role"`
|
|
Code string `json:"code" v:"required"`
|
|
Name string `json:"name" v:"required"`
|
|
Status int `json:"status"`
|
|
MenuIds []uint64 `json:"menuIds"`
|
|
}
|
|
|
|
// RoleCreateRes is the response of RoleCreateReq.
|
|
type RoleCreateRes struct {
|
|
Id uint64 `json:"id"`
|
|
}
|
|
|
|
// RoleUpdateReq updates a role and rebinds menu ids.
|
|
type RoleUpdateReq struct {
|
|
g.Meta `path:"/system/role/{id}" method:"put" tags:"Admin/System/Role" summary:"Update role"`
|
|
Id uint64 `json:"id" in:"path" v:"required"`
|
|
Name string `json:"name" v:"required"`
|
|
Status int `json:"status"`
|
|
MenuIds []uint64 `json:"menuIds"`
|
|
}
|
|
|
|
// RoleUpdateRes is the response of RoleUpdateReq.
|
|
type RoleUpdateRes struct{}
|
|
|
|
// RoleDeleteReq deletes a role (soft delete).
|
|
type RoleDeleteReq struct {
|
|
g.Meta `path:"/system/role/{id}" method:"delete" tags:"Admin/System/Role" summary:"Delete role"`
|
|
Id uint64 `json:"id" in:"path" v:"required"`
|
|
}
|
|
|
|
// RoleDeleteRes is the response of RoleDeleteReq.
|
|
type RoleDeleteRes struct{}
|