user.api 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. import "../base.api"
  2. type (
  3. // The response data of user information | 用户信息
  4. UserInfo {
  5. BaseUUIDInfo
  6. // Status | 状态
  7. Status *uint32 `json:"status,optional" validate:"omitempty,lt=20"`
  8. // Username | 用户名
  9. Username *string `json:"username,optional" validate:"omitempty,max=50"`
  10. // Nickname | 昵称
  11. Nickname *string `json:"nickname,optional" validate:"omitempty,max=40"`
  12. // Password | 密码
  13. Password *string `json:"password,optional" validate:"omitempty,min=6"`
  14. // Description | 描述
  15. Description *string `json:"description,optional" validate:"omitempty,max=100"`
  16. // HomePath | 首页
  17. HomePath *string `json:"homePath,optional" validate:"omitempty,max=70"`
  18. // RoleId | 角色ID
  19. RoleIds []uint64 `json:"roleIds,optional"`
  20. // Mobile | 手机号
  21. Mobile *string `json:"mobile,optional" validate:"omitempty,max=18"`
  22. // Email | 邮箱
  23. Email *string `json:"email,optional" validate:"omitempty,max=80"`
  24. // Avatar | 头像地址
  25. Avatar *string `json:"avatar,optional" validate:"omitempty,max=300"`
  26. // Department ID | 部门ID
  27. DepartmentId *uint64 `json:"departmentId,optional,omitempty"`
  28. // Position ID | 职位ID
  29. PositionIds []uint64 `json:"positionId,optional,omitempty"`
  30. }
  31. // User information response | 用户信息返回体
  32. UserInfoResp {
  33. BaseDataInfo
  34. // User information | User数据
  35. Data UserInfo `json:"data"`
  36. }
  37. // The response data of user's basic information | 用户基本信息返回数据
  38. UserBaseIDInfoResp {
  39. BaseDataInfo
  40. // The data of user's basic information | 用户基本信息
  41. Data UserBaseIDInfo `json:"data"`
  42. }
  43. // The data of user's basic information | 用户基本信息
  44. UserBaseIDInfo {
  45. // User's UUID | 用户的UUID
  46. UUID *string `json:"userId"`
  47. // User's name | 用户名
  48. Username *string `json:"username"`
  49. // User's nickname | 用户的昵称
  50. Nickname *string `json:"nickname"`
  51. // The user's avatar path | 用户的头像路径
  52. Avatar *string `json:"avatar"`
  53. // The home page that the user enters after logging in | 用户登陆后进入的首页
  54. HomePath *string `json:"homePath"`
  55. // The description of user | 用户的描述信息
  56. Description *string `json:"desc"`
  57. // User's Role Name | 用户的角色名称
  58. RoleName []string `json:"roleName"`
  59. // Department Name | 部门名称
  60. DepartmentName string `json:"departmentName,optional"`
  61. // Department Name | 部门备注
  62. DepartmentRemark string `json:"departmentRemark,optional"`
  63. }
  64. UserLoginReq {
  65. JsCode *string `json:"js_code,optional"`
  66. }
  67. UserLoginResp {
  68. BaseDataInfo
  69. Data UserToken `json:"data,optional"`
  70. }
  71. GptsUserLoginReq {
  72. Username *string `json:"username"`
  73. Password *string `json:"password"`
  74. }
  75. GptsUserLoginResp {
  76. BaseDataInfo
  77. Data GptsUserToken `json:"data,optional"`
  78. }
  79. GptsUserToken {
  80. ID string `json:"id,optional"`
  81. Token string `json:"token,optional"`
  82. Username string `json:"username,optional"`
  83. ExpireTime uint64 `json:"expireTime,optional"`
  84. }
  85. PasswordReq {
  86. Password *string `json:"password"`
  87. Password2 *string `json:"password2"`
  88. }
  89. UserToken {
  90. Token *string `json:"token,optional"`
  91. ID *uint64 `json:"id,optional"`
  92. Avatar *string `json:"avatar,optional"`
  93. Nickname *string `json:"nickname,optional"`
  94. IsVip *bool `json:"isVip,optional"`
  95. }
  96. UserVipResp {
  97. BaseDataInfo
  98. Data UserVip `json:"data,optional"`
  99. }
  100. UserVip {
  101. IsVip *bool `json:"isVip,optional"`
  102. WechatAccount *string `json:"wechatAccount"`
  103. }
  104. UserBalanceResp {
  105. BaseDataInfo
  106. // User information | User数据
  107. Data BalanceInfo `json:"data"`
  108. }
  109. BalanceInfo {
  110. Balance *float32 `json:"balance"`
  111. }
  112. )
  113. @server(
  114. group: User
  115. )
  116. service Wechat {
  117. // Get user basic information | 获取用户基本信息
  118. @handler doApiUserLogin
  119. post /api/user/login (UserLoginReq) returns (UserLoginResp)
  120. // Get user basic information | 获取用户基本信息
  121. @handler doGptsUserLogin
  122. post /gpts/user/login (GptsUserLoginReq) returns (GptsUserLoginResp)
  123. // Get user basic information | 获取用户基本信息
  124. @handler getGptsUserInfo
  125. post /gpts/user/info () returns (UserInfoResp)
  126. // Update user basic information | 修改用户基本信息
  127. @handler updateGptsUserInfo
  128. post /gpts/user/update (UserInfo) returns (BaseDataInfo)
  129. // Get user balance information | 获取用户余额信息
  130. @handler getGptsUserBalance
  131. post /gpts/user/balance () returns (UserBalanceResp)
  132. // Get user basic information | 获取用户基本信息
  133. @handler updateGptsUserPwd
  134. post /gpts/user/password (PasswordReq) returns (BaseDataInfo)
  135. }
  136. @server(
  137. jwt: Auth
  138. group: User
  139. middleware: Miniprogram
  140. )
  141. service Wechat {
  142. // Get user vip information | 获取用户VIP信息
  143. @handler getApiUserVip
  144. post /api/user/vip () returns (UserVipResp)
  145. }
  146. @server(
  147. jwt: Auth
  148. group: User
  149. middleware: Authority
  150. )
  151. service Wechat {
  152. // Get user basic information | 获取用户基本信息
  153. @handler getUserInfo
  154. get /user/info returns (UserBaseIDInfoResp)
  155. }