优化页面、修复BUG
This commit is contained in:
@@ -12,6 +12,10 @@ type User struct {
|
||||
Username string `json:"username" gorm:"column:username;uniqueIndex;not null"`
|
||||
Email string `json:"email" gorm:"column:email"`
|
||||
Avatar string `json:"avatar" gorm:"column:avatar"`
|
||||
Bio string `json:"bio" gorm:"column:bio;type:text"`
|
||||
Phone string `json:"phone" gorm:"column:phone"`
|
||||
Wechat string `json:"wechat" gorm:"column:wechat"`
|
||||
WechatQrcode string `json:"wechatQrcode" gorm:"column:wechat_qrcode"`
|
||||
Password string `json:"password,omitempty" gorm:"-"` // Virtual field for input
|
||||
PasswordHash string `json:"-" gorm:"column:password_hash"`
|
||||
RoleID uint `json:"roleId" gorm:"column:role_id"`
|
||||
@@ -50,15 +54,47 @@ func (u *User) BeforeUpdate(tx *gorm.DB) error {
|
||||
|
||||
// UserResponse 用户响应模型
|
||||
type UserResponse struct {
|
||||
ID uint `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Avatar string `json:"avatar,omitempty"`
|
||||
RoleID uint `json:"roleId"`
|
||||
Role string `json:"role"`
|
||||
IsActive int `json:"isActive"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
ID uint `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Avatar string `json:"avatar,omitempty"`
|
||||
Bio string `json:"bio,omitempty"`
|
||||
Phone string `json:"phone,omitempty"`
|
||||
Wechat string `json:"wechat,omitempty"`
|
||||
WechatQrcode string `json:"wechatQrcode,omitempty"`
|
||||
RoleID uint `json:"roleId"`
|
||||
Role string `json:"role"`
|
||||
IsActive int `json:"isActive"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
}
|
||||
|
||||
// UserPublicProfile 公开用户资料(前台展示)
|
||||
type UserPublicProfile struct {
|
||||
ID uint `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Avatar string `json:"avatar,omitempty"`
|
||||
Bio string `json:"bio,omitempty"`
|
||||
Phone string `json:"phone,omitempty"`
|
||||
Wechat string `json:"wechat,omitempty"`
|
||||
WechatQrcode string `json:"wechatQrcode,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateProfileRequest 当前用户更新资料请求
|
||||
type UpdateProfileRequest struct {
|
||||
Email string `json:"email"`
|
||||
Avatar string `json:"avatar"`
|
||||
Bio string `json:"bio"`
|
||||
Phone string `json:"phone"`
|
||||
Wechat string `json:"wechat"`
|
||||
WechatQrcode string `json:"wechatQrcode"`
|
||||
}
|
||||
|
||||
// UpdatePasswordRequest 修改密码请求
|
||||
type UpdatePasswordRequest struct {
|
||||
OldPassword string `json:"oldPassword" binding:"required"`
|
||||
NewPassword string `json:"newPassword" binding:"required"`
|
||||
}
|
||||
|
||||
// LoginRequest 登录请求模型
|
||||
|
||||
Reference in New Issue
Block a user