slowwild.proto 4.3 KB

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