Files
arenax-server/internal/model/user.go

136 lines
3.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package model
import (
"time"
"github.com/gogf/gf/v2/os/gtime"
)
// User 用户信息
type User struct {
Id int64 `json:"id" orm:"id,primary"` // 用户ID
Username string `json:"username" orm:"username,not null"` // 用户名
PasswordHash string `json:"passwordHash" orm:"password_hash,not null"` // 密码哈希
Nickname string `json:"nickname" orm:"nickname"` // 昵称
Avatar string `json:"avatar" orm:"avatar"` // 头像
Phone string `json:"phone" orm:"phone"` // 手机号
Email string `json:"email" orm:"email"` // 邮箱
Gender int `json:"gender" orm:"gender,default:0"` // 性别0=未知1=男2=女
Birthday *gtime.Time `json:"birthday" orm:"birthday"` // 生日
Status int `json:"status" orm:"status,default:1"` // 状态1=正常2=禁用
LastLoginAt *gtime.Time `json:"lastLoginAt" orm:"last_login_at"` // 最后登录时间
LastLoginIp string `json:"lastLoginIp" orm:"last_login_ip"` // 最后登录IP
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at"` // 软删除时间戳
}
// UserCreateIn 创建用户请求
type UserCreateIn struct {
Username string
Password string
Nickname string
Avatar string
Phone string
Email string
Gender int
Birthday *gtime.Time
}
// UserUpdateIn 更新用户请求
type UserUpdateIn struct {
Id int64
Nickname string
Avatar string
Phone string
Email string
Gender int
Birthday *gtime.Time
Status int
}
type LoginCache struct {
Token string `json:"token"`
Status int `json:"status" dc:"0-准备扫码1-已扫码"`
CreatedAt time.Time `json:"created_at"`
}
type UserLoginIn struct {
OpenId string
}
type WeChatLogin struct {
UUID string // 使用的是微信的唯一 id而不是openid保证微信服务号小程序绑定的系统用户为同一个
}
type WeChatLoginOut struct {
Token string
}
type UserLoginOut struct {
Token string
}
type UserInfoIn struct {
Id int
OpenId string
}
type UserInfoOut struct {
Id int64
WxOpenId string
Username string
Nickname string
Avatar string
Email string
PhoneNumber string
WxPopenId string
QQPopenId string
RoleId int64
}
type UserBindPhoneIn struct {
Id int64
Phone string
PhoneCode string
}
type UserBindPhoneOut struct {
Success bool
}
type UserListIn struct {
OperatorId int64
Role string
Nickname string
Page int
Size int
}
type UserListOut struct {
List []User
Total int
}
type UserCodeIn struct {
UserId int // 绑定手机号时需要使用该字段
Phone string
}
type UserCodeOut struct {
}
type UserUpdateImgIn struct {
Id int64
Nickname string
Avatar string
}
type UserUpdateImgOut struct {
Success bool
}
type GetPhoneCodeIn struct {
Id int64
Phone string
}
type GetPhoneCodeOut struct {
Success bool
}