sys_user.go 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package request
  2. import (
  3. "server/dao"
  4. )
  5. // Register User register structure
  6. type Register struct {
  7. Username string `json:"userName" example:"用户名"`
  8. Password string `json:"passWord" example:"密码"`
  9. NickName string `json:"nickName" example:"昵称"`
  10. HeaderImg string `json:"headerImg" example:"头像链接"`
  11. AuthorityId uint `json:"authorityId" swaggertype:"string" example:"int 角色id"`
  12. Enable int `json:"enable" swaggertype:"string" example:"int 是否启用"`
  13. Phone string `json:"phone" example:"电话号码"`
  14. Email string `json:"email" example:"电子邮箱"`
  15. }
  16. // User login structure
  17. type Login struct {
  18. Username string `json:"username"` // 用户名
  19. Password string `json:"password"` // 密码
  20. Captcha string `json:"captcha"` // 验证码
  21. CaptchaId string `json:"captchaId"` // 验证码ID
  22. }
  23. // Modify password structure
  24. type ChangePasswordReq struct {
  25. ID uint `json:"-"` // 从 JWT 中提取 user id,避免越权
  26. Password string `json:"password"` // 密码
  27. NewPassword string `json:"newPassword"` // 新密码
  28. }
  29. // Modify user's auth structure
  30. type SetUserAuth struct {
  31. AuthorityId uint `json:"authorityId"` // 角色ID
  32. }
  33. // Modify user's auth structure
  34. type SetUserAuthorities struct {
  35. ID uint
  36. AuthorityId uint `json:"authorityId"` // 角色ID
  37. }
  38. type ChangeUserInfo struct {
  39. ID uint `gorm:"primarykey"` // 主键ID
  40. NickName string `json:"nickName" gorm:"default:系统用户;comment:用户昵称"` // 用户昵称
  41. Phone string `json:"phone" gorm:"comment:用户手机号"` // 用户手机号
  42. AuthorityIds uint `json:"authorityIds" gorm:"-"` // 角色ID
  43. Email string `json:"email" gorm:"comment:用户邮箱"` // 用户邮箱
  44. HeaderImg string `json:"headerImg" gorm:"default:https://qmplusimg.henrongyi.top/gva_header.jpg;comment:用户头像"` // 用户头像
  45. SideMode string `json:"sideMode" gorm:"comment:用户侧边主题"` // 用户侧边主题
  46. Enable int `json:"enable" gorm:"comment:冻结用户"` //冻结用户
  47. Authorities []dao.SysAuthority `json:"-" gorm:"many2many:sys_user_authority;"`
  48. }