sys_user.go 3.2 KB

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