-
Notifications
You must be signed in to change notification settings - Fork 0
/
sys_user.go
100 lines (86 loc) · 4.2 KB
/
sys_user.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package request
import (
"github.com/oldweipro/gin-admin/model/common/request"
"github.com/oldweipro/gin-admin/model/system"
"time"
)
// Register User register structure
type Register struct {
Username string `json:"userName" example:"用户名"`
Password string `json:"passWord" example:"密码"`
NickName string `json:"nickName" example:"昵称"`
HeaderImg string `json:"headerImg" example:"头像链接"`
AuthorityId uint `json:"authorityId" swaggertype:"string" example:"int 角色id"`
Enable int `json:"enable" swaggertype:"string" example:"int 是否启用"`
AuthorityIds []uint `json:"authorityIds" swaggertype:"string" example:"[]uint 角色id"`
Phone string `json:"phone" example:"电话号码"`
Email string `json:"email" example:"电子邮箱"`
}
type RegisterWithSmsCode struct {
Register
SmsCode string `json:"smsCode"` // 验证码
}
// ForgotPasswordWithSmsCode 找回/忘记密码
type ForgotPasswordWithSmsCode struct {
Phone string `json:"phone"`
Password string `json:"passWord"`
SmsCode string `json:"smsCode"`
}
// User login structure
type Login struct {
Username string `json:"username"` // 用户名
Password string `json:"password"` // 密码
Captcha string `json:"captcha"` // 验证码
CaptchaId string `json:"captchaId"` // 验证码ID
}
// LoginWithoutCaptcha User login structure
type LoginWithoutCaptcha struct {
Username string `json:"username"` // 用户名
Password string `json:"password"` // 密码
}
// User emailLogin structure
type EmailLogin struct {
Email string `json:"email"` // 邮箱
Password string `json:"password"` // 密码
}
// User OpenFishLogin
type OpenFishLogin struct {
Phone string `json:"phone"` // 用户名
SmsCode string `json:"smsCode"` // 验证码
}
// SmsCode
type SmsCode struct {
Mobile string `json:"mobile"` // 手机号
}
// Modify password structure
type ChangePasswordReq struct {
ID uint `json:"-"` // 从 JWT 中提取 user id,避免越权
Password string `json:"password"` // 密码
NewPassword string `json:"newPassword"` // 新密码
}
// Modify user's auth structure
type SetUserAuth struct {
AuthorityId uint `json:"authorityId"` // 角色ID
}
// Modify user's auth structure
type SetUserAuthorities struct {
ID uint
AuthorityIds []uint `json:"authorityIds"` // 角色ID
}
type ChangeUserInfo struct {
ID uint `gorm:"primarykey"` // 主键ID
NickName string `json:"nickName" gorm:"default:系统用户;comment:用户昵称"` // 用户昵称
Phone string `json:"phone" gorm:"comment:用户手机号"` // 用户手机号
AuthorityIds []uint `json:"authorityIds" gorm:"-"` // 角色ID
Email string `json:"email" gorm:"comment:用户邮箱"` // 用户邮箱
HeaderImg string `json:"headerImg" gorm:"default:https://oss.oldwei.com/openfish/avatar/2023-06-24/ef48b5f0-b8fb-46a1-812a-84fc0c0c45c6.gif;comment:用户头像"` // 用户头像
SideMode string `json:"sideMode" gorm:"comment:用户侧边主题"` // 用户侧边主题
Enable int `json:"enable" gorm:"comment:冻结用户"` //冻结用户
Authorities []system.SysAuthority `json:"-" gorm:"many2many:sys_user_authority;"`
}
type SysUseSearch struct {
system.SysUser
StartCreatedAt *time.Time `json:"startCreatedAt" form:"startCreatedAt"`
EndCreatedAt *time.Time `json:"endCreatedAt" form:"endCreatedAt"`
request.PageInfo
}