Documentation
¶
Index ¶
- Constants
- Variables
- func NewWebErr(code uint32, originalMsg ...string) error
- type CustomClaims
- type EnableRole
- type JsonResult
- type Login
- type Pager
- type Perm
- type PermTree
- type QueryRoleParam
- type Role
- type RolePerm
- type RoleSearchParams
- type RoleUser
- type SaveRole
- type SearchUser
- type User
- type WebErr
Constants ¶
View Source
const ( CodeOK = 0 CodeErr = 50 CodeNoAuth = 51 //您没有执行该操作的权限 CodeTOKENERR = 52 //token错误 CodeValidFail = 53 //格式验证错误 )
View Source
const ( RequestTypeFromData = iota + 1 RequestTypeApplicationJson )
api接受协议类型
View Source
const ( Enable = 1 //有效 Disable = 2 //无效 )
View Source
const (
IsSuper = 1 //超级用户标识
)
Variables ¶
View Source
var CodeMsg = map[uint32]string{ CodeErr: "错误", CodeNoAuth: "您没有执行该操作的权限", CodeTOKENERR: "token错误", }
View Source
var (
JwtSecretKey string //jwt验证密码
)
Functions ¶
Types ¶
type Pager ¶
type Pager struct {
Page int //当前页
PageSize int //页大小 ,页大小 小于 0 返回所有数据
Total int64 //总量
SliceData interface{} //切片源数据
}
func (*Pager) SetSliceData ¶
type Perm ¶
type Perm struct {
Id uint32
Name string
PermUrl string
PermTreeId uint32 //用于树形结构展示
Sort uint32 //排序字段
}
权限表
type Role ¶
type Role struct {
Id uint32
Name string //角色名称
Desc string //角色描述
Enable bool //角色状态:1=启用,2=禁用
CreateTime time.Time //创建时间
UpdateTime time.Time //更新时间
Perms []Perm `orm:"-"` //角色的权限信息
}
角色表
type SaveRole ¶
type SaveRole struct {
RoleId int //角色id:修改时传入
Name string //角色名称
TypeId int //角色类型
Status int //状态:1=启用,2=禁用
PermIds []int //勾选了权限项的id
}
添加角色、编辑角色
type User ¶
type User struct {
Id uint32
UserName string `field:"账号"` //用户名
Password string `field:"密码"json:"-"` //密码
Salt string `json:"-"` //密码加密盐
Name string `field:"名称" ` //姓名
Mobile string `field:"手机号" valid:"Mobile"` //手机号码
Email string `field:"邮箱" valid:"Email"` //邮箱
Memo string `field:"备注" valid:"MaxSize(20);"` //备注
Enable uint //用户状态:1=启用,2=禁用
IsSuper uint //超级用户标识:1=超级用户,其他=非超级用户
CreateTime time.Time //创建时间
UpdateTime time.Time //更新时间
}
用户表
Click to show internal directories.
Click to hide internal directories.