sys_user.go 4.5 KB

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