76 lines
1.4 KiB
Go
76 lines
1.4 KiB
Go
package models
|
|
|
|
type UserStatus int
|
|
|
|
const (
|
|
EnableUserStatus UserStatus = 0
|
|
DisableUserStatus UserStatus = 1
|
|
)
|
|
|
|
type LoginInfo struct {
|
|
Account string
|
|
Pwd string
|
|
}
|
|
|
|
type AddInfo struct {
|
|
Account string `json:"account" binding:"required"`
|
|
Name string `json:"name" binding:"required"`
|
|
Mobile string `json:"mobile" binding:"required"`
|
|
Email string `json:"email" binding:"required"`
|
|
Sex int `json:"sex"`
|
|
Pwd string `json:"pwd" binding:"required"`
|
|
}
|
|
|
|
type UserInfo struct {
|
|
Account string
|
|
Name string
|
|
Mobile string
|
|
Email string
|
|
Sex int
|
|
}
|
|
|
|
type User struct {
|
|
Id uint
|
|
UserInfo
|
|
}
|
|
|
|
type ModifyInfo struct {
|
|
Name string `json:"name" binding:"required"`
|
|
Sex int `json:"sex"`
|
|
}
|
|
|
|
type Query struct {
|
|
Page int `form:"page" json:"page" `
|
|
PageSize int `form:"page_size" json:"page_size"`
|
|
Keyword string `form:"keyword" Json:"keyword"`
|
|
Sort string `form:"sort" json:"sort" binding:"sql_sort"`
|
|
}
|
|
|
|
type ResetPwdReq struct {
|
|
Id uint `json:"id" binding:"required"`
|
|
OldPwd string `json:"old_pwd" binding:"required"`
|
|
Pwd string `json:"pwd" binding:"required"`
|
|
}
|
|
|
|
type GetUserReq struct {
|
|
Account string `form:"account" json:"account" binding:"required"`
|
|
}
|
|
|
|
func (q *Query) Default() {
|
|
if q.Page < 0 {
|
|
q.Page = 0
|
|
}
|
|
|
|
if q.PageSize <= 0 {
|
|
q.PageSize = 20
|
|
}
|
|
|
|
if len(q.Sort) == 0 {
|
|
q.Sort = "created_on desc"
|
|
}
|
|
}
|
|
|
|
type Enable struct {
|
|
Id uint `json:"id" binding:"required"`
|
|
}
|