slowwild.proto 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. syntax="proto3";
  2. package slowwildserver;
  3. option go_package="slowwild/slowwildserver";
  4. message UserEntity {
  5. int64 id = 1; // 用户id
  6. string avatar = 2; // 用户头像
  7. string nickname = 3; // 昵称
  8. string username = 4; // 用户名(唯一)
  9. string phone = 5; // 手机号码
  10. int32 status = 6; // 是否锁住1-正常2-停用
  11. int32 sex = 7; // 性别0-女1-男
  12. int64 follows = 8; //粉丝
  13. int64 followings = 9; // 关注量
  14. int32 get_likes_count = 10; //获得点赞数量
  15. int32 get_collection_count = 11; //获得收藏的数量
  16. }
  17. message UserInfo {
  18. int64 id = 1; // 用户id
  19. string avatar = 2; // 用户头像
  20. string nickname = 3; // 昵称
  21. int32 sex = 7; // 性别0-女1-男
  22. }
  23. message FollowUserInfo {
  24. UserInfo user = 1;
  25. bool is_mutual_follow = 2; // 是否互相关注
  26. }
  27. message LoginAndRegisterRsp {
  28. string token = 1; // token令牌
  29. int64 expire = 2; // 到期时间
  30. }
  31. message LoginReq {
  32. string phone = 1; //手机号
  33. string password = 2; // 密码
  34. string code = 3; //验证码
  35. int32 login_type = 4; // 登录类型
  36. string login_ip = 5; // 登录ip
  37. }
  38. message RegisterReq{
  39. string phone = 1; // 手机号码
  40. string nickname = 2; // 用户昵称
  41. string password = 3; // 密码
  42. string avatar = 4; // 头像
  43. int32 sex = 5; // 性别
  44. string username = 6; // 用户名(唯一)
  45. string code = 7; //验证码
  46. }
  47. message GetUserInfoReq {
  48. int64 user_id = 1; // 用户id
  49. int64 query_user_id = 2; // 查询用户id
  50. }
  51. message GetUserInfoResp {
  52. int64 id = 1; // 用户id
  53. string avatar = 2; // 用户头像
  54. string nickname = 3; // 昵称
  55. int32 sex = 4; // 性别0-女1-男
  56. bool is_follow = 5; // 是否关注
  57. }
  58. message FindUserReq {
  59. string username = 1; // 用户昵称
  60. string phone = 2; // 用户手机号码
  61. repeated int64 ids = 3; // 用户id
  62. }
  63. message FindUserResp {
  64. repeated UserInfo user_list = 1; // 用户信息
  65. }
  66. // 用户关注
  67. message FollowUserReq {
  68. int64 user_id = 1; // 当前登录用户id
  69. int64 follow_user_id = 2; // 被关注的用户id
  70. }
  71. message FollowUserRes {
  72. bool success = 1; // 是否关注成功
  73. }
  74. // 用户取消关注
  75. message UnFollowUserReq {
  76. int64 user_id = 1; // 当前登录的用户id
  77. int64 un_follow_user_id = 2; // 当前被取消关注的用户id
  78. }
  79. message UnFollowUserRes {
  80. bool success = 1; // 是否关注成功
  81. }
  82. // 查询粉丝列表
  83. message GetFollowingReq {
  84. int64 user_id = 1; // 当前登录用户的id
  85. int32 page_size = 2; // 数量限制
  86. int32 page = 3; // 分页开始偏移量
  87. int64 query_user_id = 4; // 查询用户的id
  88. }
  89. message GetFollowingRes {
  90. repeated FollowUserInfo list = 1;
  91. int64 total = 2;
  92. }
  93. // 查询我关注的列表
  94. message GetFollowReq {
  95. int64 user_id = 1; // 当前登录用户的id
  96. int32 page_size = 2; // 数量限制
  97. int32 page = 3; // 分页开始偏移量
  98. int64 query_user_id = 4; // 查询用户的id
  99. }
  100. message GetFollowRes {
  101. repeated FollowUserInfo list = 1;
  102. int64 total = 2;
  103. }
  104. //查询用户信息
  105. message GetUserProfileReq {
  106. int64 user_id = 1;
  107. }
  108. message GetUserProfileRes {
  109. int64 id = 1; // 用户id
  110. string nickname = 2; // 用户昵称
  111. string username = 3; // 用户名
  112. int32 status = 4; // 用户状态0-正常1-封禁中2-禁言中3-删除
  113. string avatar = 5; // 头像
  114. string phone = 6; // 手机号
  115. int32 tweet_count = 7; //帖子数
  116. bool is_following = 8; // 是否关注
  117. int64 created_on = 9; // 注册时间
  118. int64 follows = 10; // 关注数
  119. int64 fans = 11; // 粉丝数
  120. int32 get_likes_count = 12; //获得点赞数量
  121. int32 get_collection_count = 13; //获得收藏的数量
  122. int32 sex = 14; //1-男2-女
  123. }
  124. // 模糊查询用户
  125. message SearchUsernameReq {
  126. string keyword = 1;
  127. int32 page = 2;
  128. int32 page_size = 3;
  129. int64 user_id = 4;
  130. }
  131. message SearchUsernameItem {
  132. string nickname = 1;
  133. string avatar = 2;
  134. int64 id = 3;
  135. int32 sex = 4;
  136. bool is_follow = 5;
  137. }
  138. message SearchUsernameRes {
  139. repeated SearchUsernameItem list = 1;
  140. int64 total = 2;
  141. }
  142. service SlowWildServer {
  143. // 用户登录
  144. rpc Login(LoginReq) returns (LoginAndRegisterRsp);
  145. // 用户注册
  146. rpc Register(RegisterReq) returns (LoginAndRegisterRsp);
  147. // 获取用户信息
  148. rpc GetUserInfo(GetUserInfoReq) returns (GetUserInfoResp);
  149. // 查询用户信息
  150. rpc FindUser(FindUserReq) returns (FindUserResp);
  151. // 关注用户
  152. rpc UserFollow (FollowUserReq) returns (FollowUserRes);
  153. // 取消关注用户
  154. rpc UnUserFollow (UnFollowUserReq) returns (UnFollowUserRes);
  155. // 获取我得粉丝
  156. rpc GetFans (GetFollowingReq) returns (GetFollowingRes);
  157. // 查询我的关注
  158. rpc GetFollows (GetFollowingReq) returns (GetFollowingRes);
  159. // 查询用户的详细信息
  160. rpc GetUserProfile (GetUserProfileReq) returns (GetUserProfileRes);
  161. // 搜索用户名称
  162. rpc SearchUsername (SearchUsernameReq) returns (SearchUsernameRes);
  163. }