sys_user.go 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. type ResetPassword struct {
  32. ID uint `json:"ID" form:"ID"`
  33. Password string `json:"password" form:"password" gorm:"comment:用户登录密码"` // 用户登录密码
  34. }
  35. // SetUserAuth Modify user's auth structure
  36. type SetUserAuth struct {
  37. AuthorityId uint `json:"authorityId"` // 角色ID
  38. }
  39. // SetUserAuthorities Modify user's auth structure
  40. type SetUserAuthorities struct {
  41. ID uint
  42. AuthorityIds []uint `json:"authorityIds"` // 角色ID
  43. }
  44. type ChangeUserInfo struct {
  45. ID uint `gorm:"primarykey"` // 主键ID
  46. NickName string `json:"nickName" gorm:"default:系统用户;comment:用户昵称"` // 用户昵称
  47. Phone string `json:"phone" gorm:"comment:用户手机号"` // 用户手机号
  48. AuthorityIds []uint `json:"authorityIds" gorm:"-"` // 角色ID
  49. Email string `json:"email" gorm:"comment:用户邮箱"` // 用户邮箱
  50. HeaderImg string `json:"headerImg" gorm:"default:https://qmplusimg.henrongyi.top/gva_header.jpg;comment:用户头像"` // 用户头像
  51. Enable int `json:"enable" gorm:"comment:冻结用户"` //冻结用户
  52. Authorities []system.SysAuthority `json:"-" gorm:"many2many:sys_user_authority;"`
  53. }
  54. type GetUserList struct {
  55. common.PageInfo
  56. Username string `json:"username" form:"username"`
  57. NickName string `json:"nickName" form:"nickName"`
  58. Phone string `json:"phone" form:"phone"`
  59. Email string `json:"email" form:"email"`
  60. }