Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateSysRole ¶
type CreateSysUser ¶
type CreateSysUser struct {
Username string `form:"username" json:"username" xml:"username" gorm:"unique;not null;comment:用户名称"`
Password string `json:"password,omitempty" xml:"password" gorm:"comment:密码"`
Nickname string `form:"nickname" json:"nickname" xml:"nickname" gorm:"comment:用户昵称"`
Email string `form:"email" json:"email" xml:"email" gorm:"comment:邮箱"`
Mobile string `form:"mobile" json:"mobile" xml:"mobile" gorm:"comment:手机号"`
Roles *Roles `form:"roles" json:"roles" xml:"roles" gorm:"comment:多角色"`
Role string `form:"role" json:"role" xml:"role" gorm:"comment:用户角色"`
Organize string `form:"organize" json:"organize"`
Department string `form:"department" json:"department"`
Position string `form:"position" json:"position"`
Status string `form:"status" json:"status" xml:"status" gorm:"comment:账号状态;default:no"`
}
CreateSysUser 创建用户时使用这个结构体接收前端提交的数据, 使用 CreateSysUser 而不使用 SysUser 结构体是为了避免前端传入了,不该传入的参数
type DefaultRole ¶
type Model ¶
type Model struct {
// 自增ID
ID uint `json:"id" xml:"id" gorm:"primarykey"`
// 创建时间
CreatedAt time.Time `json:"createdAt" xml:"createdAt"`
// 更新时间
UpdatedAt time.Time `json:"updatedAt" xml:"updatedAt"`
// 删除时间
DeletedAt gorm.DeletedAt `json:"deletedAt,omitempty" xml:"deletedAt" gorm:"index"`
}
func (*Model) BeforeCreate ¶
BeforeCreate 钩子函数: 创建前Gorm会调用
type ModifyEmail ¶
type ModifyEmail struct {
UID string `json:"-"`
Captcha string `json:"captcha"`
Email string `json:"email" binding:"required,email"`
}
ModifyEmail 修改邮箱使用的结构体
type ModifyMobile ¶
type ModifyMobile struct {
UID string `json:"-"`
Captcha string `json:"captcha" binding:"required"`
Mobile string `json:"mobile" binding:"required"`
}
ModifyMobile 修改手机号使用的结构体
type ModifyPassword ¶
type ModifyPassword struct {
UID string `json:"-"`
OldPassword string `json:"oldPassword" binding:"required"`
NewPassword string `json:"newPassword" binding:"required"`
}
ModifyPassword 修改密码使用的结构体
type MongoModel ¶
type PageReq ¶
type PageReq struct {
// 这个字段对前端隐藏,只服务于后端
UID string ` form:"-" json:"-"`
// 前端传过来用于查询数据的ID
ID string ` form:"id" json:"id"`
// 所查询的数据总量
Total int64 `json:"total,omitempty" form:"total"`
// 页
Page int `json:"page,omitempty" form:"page"`
// 页大小
PageSize int `json:"pageSize,omitempty" form:"pageSize"`
// 查询关键词
Keyword string `json:"keyword" form:"keyword"`
// 查询类型
Type int `json:"type" form:"type"`
}
PageReq 分页查询使用的结构体
type SysRole ¶
type SysRole struct {
Model
Role string `form:"role" json:"role" xml:"role" gorm:"unique;not null;comment:角色ID" binding:"required"`
RoleName string `form:"roleName" json:"roleName" xml:"roleName" gorm:"unique;not null;comment:角色名称" binding:"required"`
}
SysRole 角色结构体
type SysRoleQueryPage ¶
type SysUser ¶
type SysUser struct {
//基础字段
Model
//用户uid
UID string `form:"uid" json:"uid" xml:"uid" gorm:"unique;not null;comment:用户唯一标识符"`
// 用户名
Username string `form:"username" json:"username" xml:"username" gorm:"unique;not null;comment:用户名称"`
// 用户密码
Password string `json:"password,omitempty" xml:"password" gorm:"comment:密码"`
// 昵称
Nickname string `form:"nickname" json:"nickname" xml:"nickname" gorm:"comment:用户昵称"`
//email
Email string `form:"email" json:"email" xml:"email" gorm:"comment:邮箱"`
//手机号
Mobile string `form:"mobile" json:"mobile" xml:"mobile" gorm:"comment:手机号"`
//头像
Avatar string `json:"avatar" gorm:"comment:头像"`
// 个人介绍
Introduction string `json:"introduction" gorm:"comment:介绍"`
// 个人博客网站
PersonalWebsite string `json:"personalWebsite" gorm:"comment:个人网站"`
//认证标志
Certification int `json:"certification" gorm:"comment:认证"`
// 多角色字段
Roles *Roles `form:"roles" json:"roles" xml:"roles" gorm:"comment:多角色"`
//现有的默认角色
Role string `form:"role" json:"role" xml:"role" gorm:"comment:用户角色"`
//账号状态,一般 yes 正常,no 异常封禁
Status string `form:"status" json:"status" xml:"status" gorm:"comment:账号状态;default:no"`
// 存放 角色ID,角色名称等角色信息,方便前端展示使用
RoleStr []RoleStr `json:"roleStr,omitempty" gorm:"-"`
//组织
Organize string `form:"organize" json:"organize"`
//部门
Department string `form:"department" json:"department"`
//职位
Position string `form:"position" json:"position"`
}
SysUser 用户结构体
type SysUserReq ¶
type SysUserReq struct {
PageReq
Username string `json:"username" xml:"username" form:"username"`
Email string `json:"email" xml:"email" form:"email" `
Mobile string `form:"mobile" json:"mobile" form:"mobile"`
Organize string `form:"organize" json:"organize"`
Department string `form:"department" json:"department"`
Position string `form:"position" json:"position"`
Status string `form:"status" json:"status"`
}
type UpdateUserInfo ¶
type UpdateUserInfo struct {
UID string `form:"uid" json:"uid" xml:"uid" gorm:"unique;not null;comment:用户唯一标识符"`
Nickname string `form:"nickname" json:"nickname" xml:"nickname" gorm:"comment:用户昵称"`
Avatar string `json:"avatar" gorm:"comment:头像"`
Introduction string `json:"introduction" gorm:"comment:介绍"`
PersonalWebsite string `json:"personalWebsite" gorm:"comment:个人网站"`
}
UpdateUserInfo 使用 UpdateUserInfo 结构体也是为了避免前端传入了,不该传入的参数, 对可以随便修改无关紧要的字段 使用这个就行; 敏感数据或隐私数据,需要通过相应验证后才能修改,一般会独立写接口单独更新
Click to show internal directories.
Click to hide internal directories.