account.proto 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. syntax = "proto3";
  2. package uu.mobile;
  3. import "base.proto";
  4. option java_multiple_files = true;
  5. option java_package = "com.usoftchina.uu.mobile.grpc.api";
  6. // 账户服务
  7. service AccountService {
  8. // 注册
  9. rpc signup (AccountSignupRequest) returns (AccountSignupResponse) {};
  10. // 登录
  11. rpc signin (AccountSigninRequest) returns (AccountSigninResponse) {};
  12. // 切换公司
  13. rpc switchCompany (SwitchCompanyRequest) returns (SwitchCompanyResponse) {};
  14. // 获取已登录账户信息
  15. rpc getInfo (GetAccountInfoRequest) returns (GetAccountInfoResponse) {};
  16. // 保存账户信息
  17. rpc saveInfo (SaveAccountInfoRequest) returns (SaveAccountInfoResponse) {};
  18. // 退出
  19. rpc signout (AccountSignoutRequest) returns (AccountSignoutResponse) {};
  20. }
  21. // 身份令牌,超时需重新登录
  22. message AuthedToken {
  23. // 令牌
  24. string token = 1;
  25. // 有效期/秒
  26. int32 expire = 2;
  27. // 产生时间
  28. int64 timestamp = 3;
  29. }
  30. // 注册请求参数
  31. message AccountSignupRequest {
  32. // 手机号
  33. string mobile = 1;
  34. // 密码
  35. string password = 2;
  36. // 真实姓名
  37. string realname = 3;
  38. // 邮箱
  39. string email = 4;
  40. // 性别
  41. AccountInfo.Sex sex = 5;
  42. // 头像
  43. string avatarUrl = 6;
  44. }
  45. // 注册响应参数
  46. message AccountSignupResponse {
  47. ResponseHeader responseHeader = 1;
  48. }
  49. // 登录请求参数
  50. message AccountSigninRequest {
  51. // 手机号
  52. string mobile = 1;
  53. // 密码
  54. string password = 2;
  55. // 设备信息
  56. DeviceInfo deviceInfo = 3;
  57. }
  58. // 登录响应参数
  59. message AccountSigninResponse {
  60. ResponseHeader responseHeader = 1;
  61. // 身份令牌
  62. AuthedToken authedToken = 2;
  63. // 账户信息
  64. AccountInfo account = 3;
  65. // 当前选择的公司(如果只有一个公司,会自动登录到该公司)
  66. int64 activeCompanyId = 4;
  67. // 账户已绑定公司
  68. repeated Company company = 5;
  69. }
  70. // 切换公司请求参数
  71. message SwitchCompanyRequest {
  72. // 公司ID
  73. int64 companyId = 1;
  74. }
  75. // 切换公司响应参数
  76. message SwitchCompanyResponse {
  77. ResponseHeader responseHeader = 1;
  78. // 身份令牌
  79. AuthedToken authedToken = 2;
  80. }
  81. // 获取账户信息请求参数
  82. message GetAccountInfoRequest {
  83. }
  84. // 获取账户信息响应参数
  85. message GetAccountInfoResponse {
  86. ResponseHeader responseHeader = 1;
  87. // 账户信息
  88. AccountInfo account = 2;
  89. // 当前选择的公司
  90. int64 activeCompanyId = 3;
  91. // 账户已绑定公司
  92. repeated Company company = 4;
  93. }
  94. // 保存账户信息请求参数
  95. message SaveAccountInfoRequest {
  96. // 真实姓名
  97. string realname = 1;
  98. // 头像
  99. string avatarUrl = 2;
  100. // 性别
  101. AccountInfo.Sex sex = 3;
  102. }
  103. // 保存账户信息响应参数
  104. message SaveAccountInfoResponse {
  105. ResponseHeader responseHeader = 1;
  106. }
  107. // 退出请求参数
  108. message AccountSignoutRequest {
  109. }
  110. // 退出响应参数
  111. message AccountSignoutResponse {
  112. ResponseHeader responseHeader = 1;
  113. }
  114. // 密码找回相关
  115. service PasswordService {
  116. // 手机验证码方式找回密码,发送手机验证码
  117. rpc sendCheckCodeByMobile (SendCheckCodeByMobileRequest) returns (SendCheckCodeByMobileResponse) {};
  118. // 手机验证码方式找回密码,校验验证码
  119. rpc resetByCheckCode (ResetByCheckCodeRequest) returns (ResetByCheckCodeResponse) {};
  120. // 邮箱链接方式找回密码,按手机号获取邮箱号
  121. rpc getEmailByMobile (GetEmailByMobileRequest) returns (GetEmailByMobileResponse) {};
  122. // 发送带验证链接的邮件
  123. rpc sendCheckEmail (SendCheckEmailRequest) returns (SendCheckEmailResponse) {};
  124. }
  125. // 手机验证码方式找回密码,发送手机验证码请求参数
  126. message SendCheckCodeByMobileRequest {
  127. string mobile = 1;
  128. }
  129. // 手机验证码方式找回密码,发送手机验证码响应参数
  130. message SendCheckCodeByMobileResponse {
  131. ResponseHeader responseHeader = 1;
  132. // 本次验证标志
  133. string token = 2;
  134. }
  135. // 手机验证码方式找回密码,重置密码请求参数
  136. message ResetByCheckCodeRequest {
  137. string mobile = 1;
  138. // SendCheckCodeByMobileResponse返回的token标志
  139. string token = 2;
  140. // 验证码
  141. string code = 3;
  142. // 新的密码
  143. string password = 4;
  144. }
  145. // 手机验证码方式找回密码,重置密码响应参数
  146. message ResetByCheckCodeResponse {
  147. ResponseHeader responseHeader = 1;
  148. }
  149. // 邮箱链接方式找回密码,按手机号获取邮箱号请求参数
  150. message GetEmailByMobileRequest {
  151. string mobile = 1;
  152. }
  153. // 邮箱链接方式找回密码,按手机号获取邮箱号响应参数
  154. message GetEmailByMobileResponse {
  155. ResponseHeader responseHeader = 1;
  156. // 本次验证标志
  157. string token = 2;
  158. string email = 3;
  159. }
  160. // 发送带验证链接的邮件请求参数
  161. message SendCheckEmailRequest {
  162. string token = 1;
  163. }
  164. // 发送带验证链接的邮件响应参数
  165. message SendCheckEmailResponse {
  166. ResponseHeader responseHeader = 1;
  167. }