Documentation
¶
Index ¶
- Variables
- type COUNT
- type DATA
- type PAGEANDLIMIT
- type RESPONSE
- type RESPONSEWITHCOUNT
- type RemoveRequest
- type RemovesRequest
- type State
- type StatusRequest
- type UserData
- type UserGetRequest
- type UserInsertRequest
- type UserListRequest
- type UserLoginRequest
- type UserLoginResponse
- type UserUpdateRequest
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SUC_LOGIN = &State{0, "登录成功"} ERR_PARAMS = &State{10001, "参数错误"} ERR_SYSTEM = &State{10002, "系统异常,请稍后重试。"} // common ERR_NO_DATA = &State{30001, "没有数据"} ERR_INSERT = &State{30002, "新增失败"} ERR_UPDATE = &State{30003, "更新失败"} ERR_DELETE = &State{30004, "删除失败"} )
View Source
var ( ERR_USER_NOT_EXISTS = &State{20001, "该用户不存在。"} ERR_USER_FORBIDDEN = &State{20002, "该用户被禁止登录系统。"} ERR_USER_PASSWORD = &State{20003, "密码错误。"} ERR_USER_PASSWORD_INCONFORMITY = &State{20003, "密码和确认密码不一致。"} ERR_USER_CAN_NOT_DELETE_LOGIN = &State{20004, "不能删除当前登录用户。"} ERR_USER_NO_LOGIN = &State{20005, "未登录,请先登录。"} ERR_USER_SYSTEM_UNSAFE = &State{20006, "系统异常,请重新登录。"} ERR_USER_LOGIN_OUT_TIME = &State{20007, "登录失效,请重新登录。"} ERR_USER_CAN_NOT_FORBIDDEN_LOGIN = &State{20004, "不能禁用当前登录用户。"} )
定义用户相关状态码
Functions ¶
This section is empty.
Types ¶
type DATA ¶
type DATA struct {
ID uint `json:"id" db:"id"` // id
Status int `json:"status" db:"status"` // 状态 1:启用 2:禁用
IsDelete int `json:"-" db:"is_delete"` // 是否删除 1:是 2:否
InsertAt time.Time `json:"insert_at" db:"insert_at"` // 入库时间
UpdateAt time.Time `json:"update_at" db:"update_at"` // 更新时间
}
base context
type PAGEANDLIMIT ¶
type RESPONSE ¶
type RESPONSE struct {
Code int `json:"code" default:"0"` // 状态码 0:成功 非0:失败 失败可直接提示msg信息
Msg string `json:"msg" default:"success"` // 状态信息
Data interface{} `json:"data"` // 数据 成功返回指定数据 失败返回nil
}
response context
func NewRESPONSE ¶
func NewRESPONSE() *RESPONSE
type RESPONSEWITHCOUNT ¶
func (*RESPONSEWITHCOUNT) COUNT ¶
func (resp *RESPONSEWITHCOUNT) COUNT(count int)
type RemoveRequest ¶
type RemovesRequest ¶
type StatusRequest ¶
type UserData ¶
type UserData struct {
*DATA
Account string `json:"account" db:"account"` // 账户
UserName string `json:"username" db:"username"` // 用户名
Password string `json:"-" db:"password"`
Salt string `json:"-" db:"salt"`
}
用户表数据
type UserGetRequest ¶
type UserInsertRequest ¶
type UserInsertRequest struct {
Account string `json:"account" insert:"account"` // 账户
UserName string `json:"username" insert:"username"` // 用户名
Password string `json:"password" insert:"password"` // 密码
ComfirmPassword string `json:"confirmPassword"` // 确认密码
Salt string `insert:"salt"` // 盐
Status int `json:"status" default:"2" insert:"status"` // 状态 1:启用 2:禁用
IsDelete int `default:"2" insert:"is_delete"` // 是否删除 1:是 0:否
}
type UserListRequest ¶
type UserListRequest struct {
Id uint `order:"id desc"`
Account string `form:"account" where:"account,like"` // 账户
Status int `form:"status" where:"status"` // 状态
IsDelete int `where:"is_delete" default:"2"` // 是否删除
*PAGEANDLIMIT
}
type UserLoginRequest ¶
type UserLoginResponse ¶
type UserUpdateRequest ¶
type UserUpdateRequest struct {
Id uint `json:"id" where:"id"` // 用户ID
Account string `json:"account" update:"account"` // 账户
UserName string `json:"username" update:"username"` // 用户名
Password string `json:"password" update:"password"` // 密码
ComfirmPassword string `json:"confirmPassword"` // 确认密码
IsDelete int `default:"2" where:"is_delete"` // 是否删除 1:是 0:否
}
Click to show internal directories.
Click to hide internal directories.