Documentation ¶
Index ¶
- Variables
- func AddRoleForUser(admin *Admin) error
- func ChangeAvatar(ctx *gin.Context)
- func Create(req *Request) (uint, error)
- func CreateAdmin(ctx *gin.Context)
- func DeleteAdmin(ctx *gin.Context)
- func GetAdmin(ctx *gin.Context)
- func GetAll(ctx *gin.Context)
- func GetMigration() *gormigrate.Migration
- func Group(group *gin.RouterGroup)
- func IsAdminUser(id uint) error
- func Profile(ctx *gin.Context)
- func UpdateAdmin(ctx *gin.Context)
- func UpdateAvatar(db *gorm.DB, id uint, avatar string) error
- func UserNameScope(username string) func(db *gorm.DB) *gorm.DB
- type Admin
- type Avatar
- type BaseAdmin
- type LoginResponse
- type PageResponse
- type ReqPaginate
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUserNameInvalide = errors.New("用户名名称已经被使用")
View Source
var Source = new(source)
Functions ¶
func GetMigration ¶
func GetMigration() *gormigrate.Migration
func Group ¶
func Group(group *gin.RouterGroup)
func IsAdminUser ¶
Types ¶
type Admin ¶
type Admin struct { gorm.Model Password string `json:"-" gorm:"not null;type:varchar(128);comment:用户登录密码"` BaseAdmin AuthorityIds []uint `json:"authorityIds" gorm:"-"` }
type Avatar ¶
type Avatar struct {
HeaderImg string `json:"headerImg" gorm:"default:http://qmplusimg.henrongyi.top/head.png;comment:用户头像" form:"headerImg"`
}
type BaseAdmin ¶
type BaseAdmin struct { Username string `json:"username" gorm:"not null;type:varchar(32);comment:用户登录名"` Status int `gorm:"column:status;type:tinyint(1);not null;default:1" json:"status"` // 账号冻结 1为正常,2为禁止 IsShow int `gorm:"column:is_show;type:tinyint(1);not null;default:1" json:"isShow"` // 是否显示 1为正常,2为禁止 Email string `json:"email" gorm:"default:'';comment:员工邮箱"` Phone string `json:"phone" gorm:"type:char(15);default:'';comment:员工手机号" ` NickName string `json:"nickName" gorm:"type:varchar(16);default:'员工姓名';comment:员工姓名" ` Avatar }
type LoginResponse ¶
type LoginResponse struct { orm.ReqId Password string `json:"password"` AuthorityIds []string `gorm:"-" json:"authorityIds"` }
func FindPasswordByUserName ¶
type PageResponse ¶
type PageResponse struct {
Item []*Response
}
Paginate 分页
type ReqPaginate ¶
type Request ¶
type Request struct { BaseAdmin Password string `json:"password"` AuthorityIds []uint `json:"authorityIds"` }
func GetSources ¶
Click to show internal directories.
Click to hide internal directories.