user.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. // Copyright 2019 github.com. All rights reserved.
  2. // Use of this source code is governed by github.com.
  3. package v1
  4. import (
  5. "property-applete-gateway/param/base"
  6. "property-applete-gateway/pb/v1"
  7. )
  8. type LoginBody struct {
  9. User string `form:"user"`
  10. Password string `form:"password"`
  11. }
  12. type LoginRequest struct {
  13. base.Header
  14. LoginBody
  15. }
  16. type LoginData struct {
  17. Uid int64 `json:"uid"`
  18. Token string `json:"token"`
  19. User string `json:"user"`
  20. IsSuper bool `json:"is_super"`
  21. Permissions []v1.SystemGroupPermissionData `json:"permissions"`
  22. }
  23. type LoginResponse struct {
  24. base.Result
  25. Data LoginData `json:"data"`
  26. // 当账号存在多个小区时使用phone_data
  27. PhoneData LoginByPhoneData `json:"phone_data"`
  28. }
  29. type TokenRequest struct {
  30. base.Header
  31. }
  32. type TokenResponse struct {
  33. base.Result
  34. Data string `json:"data"`
  35. RefreshToken string `json:"refresh_token"`
  36. }
  37. type GetVcodeQuery struct {
  38. Phone string `form:"phone"`
  39. }
  40. type GetVcodeRequest struct {
  41. GetVcodeQuery
  42. }
  43. type GetVcodeResponse struct {
  44. base.Result
  45. Data v1.GetVcodeReply `json:"data"`
  46. }
  47. type LoginByPhoneBody struct {
  48. // 短信验证码
  49. Vcode uint32 `form:"vcode"`
  50. Phone string `form:"phone"`
  51. }
  52. type LoginByPhoneRequest struct {
  53. base.Header
  54. LoginByPhoneBody
  55. }
  56. type LoginByPhoneItem struct {
  57. Uid int64 `json:"uid"`
  58. User string `json:"user"`
  59. GardenName string `json:"garden_name"`
  60. GardenId int64 `json:"garden_id"`
  61. IsSuper bool `json:"is_super"`
  62. Permissions []v1.SystemGroupPermissionData `json:"permissions"`
  63. }
  64. type LoginByPhoneData struct {
  65. List []LoginByPhoneItem `json:"list"`
  66. Token string `json:"token"`
  67. }
  68. type LoginByPhoneResponse struct {
  69. base.Result
  70. Data LoginByPhoneData `json:"data"`
  71. }
  72. type ChooseUserQuery struct {
  73. Id int64 `form:"id" json:"id"`
  74. }
  75. type ChooseUserRequest struct {
  76. base.Header
  77. ChooseUserQuery
  78. }
  79. type ChooseUserResponse struct {
  80. base.Result
  81. Data LoginData `json:"data"`
  82. }
  83. type ResetPasswordBody struct {
  84. Phone string `form:"phone" json:"phone"`
  85. // 用户id,第一次调用时为空,如果电话对应多个账号,选择账号后第二次调用需填该值
  86. Uid int64 `form:"uid" json:"uid"`
  87. // 短信验证码
  88. Vcode uint32 `form:"vcode" json:"vcode"`
  89. Password string `form:"password" json:"password"`
  90. }
  91. type ResetPasswordRequest struct {
  92. ResetPasswordBody
  93. }
  94. type ResetPasswordResponse struct {
  95. base.Result
  96. Data v1.ResetPasswordReply `json:"data"`
  97. }
  98. type ChangePasswordBody struct {
  99. OldPassword string `form:"old_password" json:"old_password"`
  100. NewPassword string `form:"new_password" json:"new_password"`
  101. }
  102. type ChangePasswordRequest struct {
  103. base.Header
  104. ChangePasswordBody
  105. }
  106. type ChangePasswordResponse struct {
  107. base.Result
  108. }
  109. type CompanyEnterGardenRequest struct {
  110. base.Header
  111. }
  112. type CompanyEnterGardenResponse struct {
  113. base.Result
  114. Data LoginData `json:"data"`
  115. }
  116. type StatisticRequest struct{
  117. base.Header
  118. }
  119. type StatisticResponse struct {
  120. base.Result
  121. Data v1.StatisticReply `json:"data"`
  122. }