service.xpcool.com/api/admin/system/role/role.go

64 lines
2.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Package admin_system_role 定义角色管理接口(角色及其菜单绑定),路由前缀 /admin。
package admin_system_role
import "github.com/gogf/gf/v2/frame/g"
// RoleItem 角色列表中的一行。
type RoleItem struct {
Id uint64 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
Status int `json:"status"`
MenuIds []uint64 `json:"menuIds"` // 已绑定的菜单 id编辑用
CreatedAt string `json:"createdAt"`
}
// RoleListReq 分页查询角色。
type RoleListReq struct {
g.Meta `path:"/system/role/list" method:"post" tags:"Admin/System/Role" summary:"角色列表"`
Page int `json:"page" d:"1" v:"min:1"`
Size int `json:"size" d:"10" v:"min:1|max:100"`
Keyword string `json:"keyword"` // 匹配角色码或名称
}
// RoleListRes 是 RoleListReq 的响应。
type RoleListRes struct {
List []*RoleItem `json:"list"`
Total int `json:"total"`
}
// RoleCreateReq 创建角色并绑定菜单。
type RoleCreateReq struct {
g.Meta `path:"/system/role/create" method:"post" tags:"Admin/System/Role" summary:"创建角色"`
Code string `json:"code" v:"required"`
Name string `json:"name" v:"required"`
Status int `json:"status"`
MenuIds []uint64 `json:"menuIds"`
}
// RoleCreateRes 是 RoleCreateReq 的响应。
type RoleCreateRes struct {
Id uint64 `json:"id"`
}
// RoleUpdateReq 更新角色并重新绑定菜单。
type RoleUpdateReq struct {
g.Meta `path:"/system/role/update/{id}" method:"post" tags:"Admin/System/Role" summary:"更新角色"`
Id uint64 `json:"id" in:"path" v:"required"`
Name string `json:"name" v:"required"`
Status int `json:"status"`
MenuIds []uint64 `json:"menuIds"`
}
// RoleUpdateRes 是 RoleUpdateReq 的响应。
type RoleUpdateRes struct{}
// RoleDeleteReq 删除角色(软删除)。
type RoleDeleteReq struct {
g.Meta `path:"/system/role/delete/{id}" method:"post" tags:"Admin/System/Role" summary:"删除角色"`
Id uint64 `json:"id" in:"path" v:"required"`
}
// RoleDeleteRes 是 RoleDeleteReq 的响应。
type RoleDeleteRes struct{}