sys_user.go 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. package system
  2. import (
  3. "github.com/gogf/gf/v2/frame/g"
  4. commonApi "github.com/tiger1103/gfast/v3/api/v1/common"
  5. "github.com/tiger1103/gfast/v3/internal/app/system/model"
  6. "github.com/tiger1103/gfast/v3/internal/app/system/model/entity"
  7. )
  8. type UserMenusReq struct {
  9. g.Meta `path:"/user/getUserMenus" tags:"用户管理" method:"get" summary:"获取用户菜单"`
  10. Authorization string `p:"Authorization" in:"header" dc:"Bearer {{token}}"`
  11. }
  12. type UserMenusRes struct {
  13. g.Meta `mime:"application/json"`
  14. MenuList []*model.UserMenus `json:"menuList"`
  15. Permissions []string `json:"permissions"`
  16. }
  17. // UserSearchReq 用户搜索请求参数
  18. type UserSearchReq struct {
  19. g.Meta `path:"/user/list" tags:"用户管理" method:"get" summary:"用户列表"`
  20. DeptId string `p:"deptId"` //部门id
  21. Mobile string `p:"mobile"`
  22. Status string `p:"status"`
  23. KeyWords string `p:"keyWords"`
  24. commonApi.PageReq
  25. }
  26. type UserSearchRes struct {
  27. g.Meta `mime:"application/json"`
  28. UserList []*model.SysUserRoleDeptRes `json:"userList"`
  29. commonApi.ListRes
  30. }
  31. type UserGetParamsReq struct {
  32. g.Meta `path:"/user/params" tags:"用户管理" method:"get" summary:"用户维护参数获取"`
  33. }
  34. type UserGetParamsRes struct {
  35. g.Meta `mime:"application/json"`
  36. RoleList []*entity.SysRole `json:"roleList"`
  37. Posts []*entity.SysPost `json:"posts"`
  38. }
  39. // SetUserReq 添加修改用户公用请求字段
  40. type SetUserReq struct {
  41. DeptId uint64 `p:"deptId" v:"required#用户部门不能为空"` //所属部门
  42. Email string `p:"email" v:"email#邮箱格式错误"` //邮箱
  43. NickName string `p:"nickName" v:"required#用户昵称不能为空"`
  44. Mobile string `p:"mobile" v:"required|phone#手机号不能为空|手机号格式错误"`
  45. PostIds []int64 `p:"postIds"`
  46. Remark string `p:"remark"`
  47. RoleIds []int64 `p:"roleIds"`
  48. Sex int `p:"sex"`
  49. Status uint `p:"status"`
  50. IsAdmin int `p:"isAdmin"` // 是否后台管理员 1 是 0 否
  51. }
  52. // UserAddReq 添加用户参数
  53. type UserAddReq struct {
  54. g.Meta `path:"/user/add" tags:"用户管理" method:"post" summary:"添加用户"`
  55. *SetUserReq
  56. UserName string `p:"userName" v:"required#用户账号不能为空"`
  57. Password string `p:"password" v:"required|password#密码不能为空|密码以字母开头,只能包含字母、数字和下划线,长度在6~18之间"`
  58. UserSalt string
  59. }
  60. type UserAddRes struct {
  61. }
  62. // UserEditReq 修改用户参数
  63. type UserEditReq struct {
  64. g.Meta `path:"/user/edit" tags:"用户管理" method:"put" summary:"修改用户"`
  65. *SetUserReq
  66. UserId int64 `p:"userId" v:"required#用户id不能为空"`
  67. }
  68. type UserEditRes struct {
  69. }
  70. type UserGetEditReq struct {
  71. g.Meta `path:"/user/getEdit" tags:"用户管理" method:"get" summary:"获取用户信息"`
  72. Id uint64 `p:"id"`
  73. }
  74. type UserGetEditRes struct {
  75. g.Meta `mime:"application/json"`
  76. User *entity.SysUser `json:"user"`
  77. CheckedRoleIds []uint `json:"checkedRoleIds"`
  78. CheckedPosts []int64 `json:"checkedPosts"`
  79. }
  80. // UserResetPwdReq 重置用户密码状态参数
  81. type UserResetPwdReq struct {
  82. g.Meta `path:"/user/resetPwd" tags:"用户管理" method:"put" summary:"重置用户密码"`
  83. Id uint64 `p:"userId" v:"required#用户id不能为空"`
  84. Password string `p:"password" v:"required|password#密码不能为空|密码以字母开头,只能包含字母、数字和下划线,长度在6~18之间"`
  85. }
  86. type UserResetPwdRes struct {
  87. }
  88. // UserStatusReq 设置用户状态参数
  89. type UserStatusReq struct {
  90. g.Meta `path:"/user/setStatus" tags:"用户管理" method:"put" summary:"设置用户状态"`
  91. Id uint64 `p:"userId" v:"required#用户id不能为空"`
  92. UserStatus uint `p:"status" v:"required#用户状态不能为空"`
  93. }
  94. type UserStatusRes struct {
  95. }
  96. type UserDeleteReq struct {
  97. g.Meta `path:"/user/delete" tags:"用户管理" method:"delete" summary:"删除用户"`
  98. Ids []int `p:"ids"`
  99. }
  100. type UserDeleteRes struct {
  101. }