第一版完成
This commit is contained in:
83
internal/model/user.go
Normal file
83
internal/model/user.go
Normal file
@@ -0,0 +1,83 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// User 用户模型
|
||||
type User struct {
|
||||
Id int `json:"id" dc:"主键"`
|
||||
Account string `json:"account" dc:"账号"`
|
||||
NickName string `json:"nick_name" dc:"昵称"`
|
||||
Avatar string `json:"avatar" dc:"头像"`
|
||||
Email string `json:"email" dc:"邮箱"`
|
||||
Password string `json:"-" dc:"登录密码"`
|
||||
Balance float64 `json:"balance" dc:"余额"`
|
||||
QrCode string `json:"qr_code" dc:"微信二维码地址"`
|
||||
RoleId int `json:"role_id" dc:"角色"`
|
||||
IsSysNotifications int `json:"is_sys_notifications" dc:"是否接受邮件系统通知"`
|
||||
IsCollectionNotifications int `json:"is_collection_notifications" dc:"是否接受收藏的项目更新信息"`
|
||||
IsMarketingNotifications int `json:"is_marketing_notifications" dc:"是否接受营销信息"`
|
||||
Ip string `json:"ip" dc:"本次登录ip"`
|
||||
IpTable interface{} `json:"ip_table" dc:"常用登录IP地址列表"`
|
||||
Status int `json:"status" dc:"状态 0:正常 1:冻结 2:封号 3:注销"`
|
||||
LastResetPasswordAt int `json:"last_reset_password_at" dc:"最后一次修改密码的时间"`
|
||||
CreatedAt *gtime.Time `json:"created_at" dc:"注册时间"`
|
||||
UpdatedAt *gtime.Time `json:"updated_at" dc:"编辑时间"`
|
||||
DeletedAt int `json:"deleted_at" dc:"删除时间"`
|
||||
}
|
||||
|
||||
// UserListRequest 用户列表请求
|
||||
type UserListRequest struct {
|
||||
Page int `json:"page" dc:"页码"`
|
||||
PageSize int `json:"page_size" dc:"每页数量"`
|
||||
Keyword string `json:"keyword" dc:"关键词"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
RoleId int `json:"role_id" dc:"角色ID"`
|
||||
}
|
||||
|
||||
// CreateUserRequest 创建用户请求
|
||||
type CreateUserRequest struct {
|
||||
Account string `json:"account" v:"required|length:3,32#账号不能为空|账号长度为3-32位" dc:"账号"`
|
||||
NickName string `json:"nick_name" v:"required|length:2,64#昵称不能为空|昵称长度为2-64位" dc:"昵称"`
|
||||
Email string `json:"email" v:"required|email#邮箱不能为空|邮箱格式不正确" dc:"邮箱"`
|
||||
Password string `json:"password" v:"required|length:6,32#密码不能为空|密码长度为6-32位" dc:"密码"`
|
||||
Avatar string `json:"avatar" dc:"头像"`
|
||||
Balance float64 `json:"balance" dc:"余额"`
|
||||
RoleId int `json:"role_id" dc:"角色ID"`
|
||||
IsSysNotifications int `json:"is_sys_notifications" dc:"是否接受邮件系统通知"`
|
||||
IsCollectionNotifications int `json:"is_collection_notifications" dc:"是否接受收藏的项目更新信息"`
|
||||
IsMarketingNotifications int `json:"is_marketing_notifications" dc:"是否接受营销信息"`
|
||||
}
|
||||
|
||||
// UpdateUserRequest 更新用户请求
|
||||
type UpdateUserRequest struct {
|
||||
NickName string `json:"nick_name" v:"required|length:2,64#昵称不能为空|昵称长度为2-64位" dc:"昵称"`
|
||||
Email string `json:"email" v:"required|email#邮箱不能为空|邮箱格式不正确" dc:"邮箱"`
|
||||
Avatar string `json:"avatar" dc:"头像"`
|
||||
Balance float64 `json:"balance" dc:"余额"`
|
||||
RoleId int `json:"role_id" dc:"角色ID"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
IsSysNotifications int `json:"is_sys_notifications" dc:"是否接受邮件系统通知"`
|
||||
IsCollectionNotifications int `json:"is_collection_notifications" dc:"是否接受收藏的项目更新信息"`
|
||||
IsMarketingNotifications int `json:"is_marketing_notifications" dc:"是否接受营销信息"`
|
||||
}
|
||||
|
||||
// ChangePasswordRequest 修改密码请求
|
||||
type ChangePasswordRequest struct {
|
||||
OldPassword string `json:"old_password" v:"required#原密码不能为空" dc:"原密码"`
|
||||
NewPassword string `json:"new_password" v:"required|length:6,32#新密码不能为空|新密码长度为6-32位" dc:"新密码"`
|
||||
}
|
||||
|
||||
// UserLoginRequest 用户登录请求
|
||||
type UserLoginRequest struct {
|
||||
Account string `json:"account" v:"required#账号不能为空" dc:"账号"`
|
||||
Password string `json:"password" v:"required#密码不能为空" dc:"密码"`
|
||||
}
|
||||
|
||||
// UserLoginResponse 用户登录响应
|
||||
type UserLoginResponse struct {
|
||||
Token string `json:"token" dc:"访问令牌"`
|
||||
ExpiresIn int `json:"expires_in" dc:"过期时间(秒)"`
|
||||
User *User `json:"user" dc:"用户信息"`
|
||||
}
|
||||
Reference in New Issue
Block a user