sys_user.go 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package request
  2. import (
  3. "server/model/common/request"
  4. "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. DeptId int `json:"deptId" example:"部门编号"`
  18. AuthId []int `json:"authId" example:"用户对文件权限"`
  19. }
  20. // User login structure
  21. type Login struct {
  22. Username string `json:"username"` // 用户名
  23. Password string `json:"password"` // 密码
  24. Captcha string `json:"captcha"` // 验证码
  25. CaptchaId string `json:"captchaId"` // 验证码ID
  26. }
  27. // Modify password structure
  28. type ChangePasswordReq struct {
  29. ID uint `json:"-"` // 从 JWT 中提取 user id,避免越权
  30. Password string `json:"password"` // 密码
  31. NewPassword string `json:"newPassword"` // 新密码
  32. }
  33. // Modify user's auth structure
  34. type SetUserAuth struct {
  35. AuthorityId uint `json:"authorityId"` // 角色ID
  36. }
  37. // Modify user's auth structure
  38. type SetUserAuthorities struct {
  39. ID uint
  40. AuthorityIds []uint `json:"authorityIds"` // 角色ID
  41. }
  42. type ChangeUserInfo struct {
  43. ID uint `gorm:"primarykey"` // 主键ID
  44. NickName string `json:"nickName" gorm:"default:系统用户;comment:用户昵称"` // 用户昵称
  45. Phone string `json:"phone" gorm:"comment:用户手机号"` // 用户手机号
  46. AuthorityIds []uint `json:"authorityIds" gorm:"-"` // 角色ID
  47. Email string `json:"email" gorm:"comment:用户邮箱"` // 用户邮箱
  48. HeaderImg string `json:"headerImg" gorm:"default:https://qmplusimg.henrongyi.top/gva_header.jpg;comment:用户头像"` // 用户头像
  49. SideMode string `json:"sideMode" gorm:"comment:用户侧边主题"` // 用户侧边主题
  50. Enable int `json:"enable" gorm:"comment:冻结用户"` //冻结用户
  51. Authorities []system.SysAuthority `json:"-" gorm:"many2many:sys_user_authority;"`
  52. AuthId []int `json:"authId" gorm:"comment:用户对文件权限" ` //用户对文件的操作权限
  53. DeptId int `json:"deptId" gorm:"type:int;comment:部门编号"` //部门编号
  54. }
  55. type SearchAppUserParams struct {
  56. system.SysUser
  57. request.PageInfo
  58. }