api.proto 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. syntax = "proto3";
  2. import "github.com/gogo/protobuf/gogoproto/gogo.proto";
  3. import "google/protobuf/empty.proto";
  4. package bbq.service.user.v1;
  5. option go_package = "api";
  6. option (gogoproto.goproto_getters_all) = false;
  7. ////////////////////////////////Relation Service/////////////////////////////////
  8. message ListRelationUserInfoReq {
  9. int64 mid = 1 [(gogoproto.moretags)='form:"mid"'];
  10. int64 up_mid = 2 [(gogoproto.moretags)='form:"up_mid" validate:"required"'];
  11. string cursor_prev = 3 [(gogoproto.moretags)='form:"cursor_prev"'];
  12. string cursor_next = 4 [(gogoproto.moretags)='form:"cursor_next"'];
  13. }
  14. message ListUserInfoReply {
  15. bool has_more = 1 [(gogoproto.jsontag) = "has_more"];
  16. repeated UserInfo list = 2 [(gogoproto.jsontag) = "list,omitempty"];
  17. }
  18. message ListRelationReq {
  19. int64 mid = 1[(gogoproto.moretags)='form:"mid" validate:"required"'];
  20. }
  21. message ListRelationReply {
  22. repeated int64 list = 1 [(gogoproto.jsontag) = "list,omitempty"];
  23. }
  24. message ModifyRelationReq {
  25. int64 mid = 1 [(gogoproto.moretags)='form:"mid" validate:"required"'];
  26. int64 up_mid = 2 [(gogoproto.moretags)='form:"up_mid" validate:"required"'];
  27. int32 action = 3 [(gogoproto.moretags)='form:"action" validate:"required"'];
  28. }
  29. message ModifyRelationReply {
  30. int32 follow_state = 1 [(gogoproto.jsontag) = "follow_state", (gogoproto.casttype) = "int8"];
  31. }
  32. ////////////////////////////////User Service/////////////////////////////////
  33. message ListUserInfoReq {
  34. int64 mid = 1 [(gogoproto.moretags)='form:"mid"'];
  35. repeated int64 up_mid = 2 [(gogoproto.moretags)='form:"up_mid,omitempty" validate:"required"'];
  36. // 是否需要用户信息数组,如区域、性别的字符串化
  37. bool need_desc = 3 [(gogoproto.moretags)='form:"need_desc"'];
  38. // 用户统计信息UserStat
  39. bool need_stat = 4 [(gogoproto.moretags)='form:"need_stat"'];
  40. // 用户关注信息是否需要
  41. bool need_follow_state = 5 [(gogoproto.moretags)='form:"need_follow_state"'];
  42. }
  43. // 获取UserInfo的配置,默认是只有UserBase的
  44. message ListUserInfoConf {
  45. // 是否需要用户信息数组,如区域、性别的字符串化
  46. bool need_desc = 1 [(gogoproto.moretags)='form:"need_desc"'];
  47. // 用户统计信息UserStat
  48. bool need_stat = 2 [(gogoproto.moretags)='form:"need_stat"'];
  49. // 用户关注信息是否需要
  50. bool need_follow_state = 3 [(gogoproto.moretags)='form:"need_follow_state"'];
  51. }
  52. message PhoneCheckReq {
  53. int64 mid = 1 [(gogoproto.moretags)='form:"mid"'];
  54. }
  55. message PhoneCheckReply {
  56. int32 tel_status = 2;// 0未绑定,1已绑定有效手机号
  57. }
  58. ////////////////////////////////Like Service/////////////////////////////////
  59. message LikeReq {
  60. int64 mid = 1 [(gogoproto.moretags)='form:"mid" validate:"required"'];
  61. int64 up_mid = 2 [(gogoproto.moretags)='form:"up_mid" validate:"required"'];
  62. int64 opid = 3 [(gogoproto.moretags)='form:"opid" validate:"required"'];
  63. }
  64. message LikeReply {
  65. int64 affected_num = 1; // 返回是否操作了数据库
  66. }
  67. message ListUserLikeReq {
  68. // int64 mid = 1 [(gogoproto.moretags)='form:"mid"'];
  69. int64 up_mid = 2 [(gogoproto.moretags)='form:"up_mid" validate:"required"'];
  70. string cursor_prev = 3 [(gogoproto.moretags)='form:"cursor_prev"'];
  71. string cursor_next = 4 [(gogoproto.moretags)='form:"cursor_next"'];
  72. }
  73. message LikeSv {
  74. int64 svid = 1 [(gogoproto.jsontag) = "svid"];
  75. string cursor_value = 2 [(gogoproto.jsontag) = "cursor_value"];
  76. }
  77. message ListUserLikeReply {
  78. bool has_more = 1 [(gogoproto.jsontag) = "has_more"];
  79. repeated LikeSv list = 2 [(gogoproto.jsontag) = "list,omitempty"];
  80. }
  81. message IsLikeReq {
  82. int64 mid = 1[(gogoproto.moretags)='form:"mid"'];
  83. repeated int64 svids = 2[(gogoproto.moretags)='form:"svids"'];
  84. }
  85. message IsLikeReply {
  86. repeated int64 list = 1[(gogoproto.jsontag) = "has_more,omitempty"];
  87. }
  88. ////////////////////////////////User Service/////////////////////////////////
  89. service User {
  90. rpc Login (UserBase) returns (UserBase);
  91. rpc PhoneCheck (PhoneCheckReq) returns (PhoneCheckReply);
  92. rpc UserEdit (UserBase) returns (.google.protobuf.Empty);
  93. rpc ListUserInfo (ListUserInfoReq) returns (ListUserInfoReply);
  94. /////////////like/////////////
  95. rpc AddLike (LikeReq) returns (LikeReply);
  96. rpc CancelLike (LikeReq) returns (LikeReply);
  97. rpc ListUserLike(ListUserLikeReq) returns (ListUserLikeReply);
  98. rpc IsLike(IsLikeReq) returns (IsLikeReply);
  99. ////////////Relation///////////
  100. rpc ModifyRelation (ModifyRelationReq) returns (ModifyRelationReply);
  101. // 返回UserInfo的列表,分页
  102. rpc ListFollowUserInfo (ListRelationUserInfoReq) returns (ListUserInfoReply);
  103. rpc ListFanUserInfo (ListRelationUserInfoReq) returns (ListUserInfoReply);
  104. rpc ListBlackUserInfo (ListRelationUserInfoReq) returns (ListUserInfoReply);
  105. // 仅仅返回全部mid列表,不包含UserInfo
  106. rpc ListFollow (ListRelationReq) returns (ListRelationReply);
  107. rpc ListBlack (ListRelationReq) returns (ListRelationReply);
  108. }
  109. ////////////////////////////////UserInfo/////////////////////////////////
  110. message UserBase {
  111. int64 mid = 1 [(gogoproto.jsontag) = "mid", (gogoproto.moretags)='form:"mid"'];
  112. string uname = 2 [(gogoproto.jsontag) = "uname", (gogoproto.moretags)='form:"uname"'];
  113. string face = 3 [(gogoproto.jsontag) = "face", (gogoproto.moretags)='form:"face"'];
  114. string birthday = 4 [(gogoproto.jsontag) = "birthday", (gogoproto.moretags)='form:"birthday"'];
  115. int64 exp = 5 [(gogoproto.moretags)='form:"exp"'];
  116. int64 level = 6 [(gogoproto.moretags)='form:"level"'];
  117. int64 ctime = 7 [(gogoproto.casttype) = "go-common/library/time.Time"];
  118. int64 mtime = 8 [(gogoproto.casttype) = "go-common/library/time.Time"];
  119. int32 sex = 9 [(gogoproto.jsontag) = "sex", (gogoproto.moretags)='form:"sex"', (gogoproto.casttype) = "int8"];
  120. int64 region = 10[(gogoproto.jsontag) = "region", (gogoproto.moretags)='form:"region"'];
  121. string signature = 11[(gogoproto.jsontag) = "signature", (gogoproto.moretags)='form:"signature"'];
  122. int32 user_type = 12[(gogoproto.jsontag) = "user_type", (gogoproto.casttype) = "int8"];
  123. int32 complete_degree = 13[(gogoproto.jsontag) = "complete_degree", (gogoproto.casttype) = "int8"];
  124. int32 new_tag = 14[(gogoproto.jsontag) = "new_tag", (gogoproto.moretags)='form:"new_tag"', (gogoproto.casttype) = "int8"]; // 是否是新注册用户
  125. string region_name = 21 [(gogoproto.jsontag) = "region_name"];
  126. repeated string user_desc = 22 [(gogoproto.jsontag) = "user_desc,omitempty"];
  127. string face_uptime = 23 [(gogoproto.jsontag) = "face_uptime", (gogoproto.moretags)='form:"uptime"'];
  128. }
  129. message UserStat {
  130. int64 sv = 1 [(gogoproto.jsontag) = "sv"];
  131. int64 like = 2 [(gogoproto.jsontag) = "like"];
  132. int64 liked = 3 [(gogoproto.jsontag) = "liked"];
  133. int64 follow = 4 [(gogoproto.jsontag) = "follow"];
  134. int64 fan = 5 [(gogoproto.jsontag) = "fan"];
  135. int64 black = 6 [(gogoproto.jsontag) = "black"];
  136. int64 view = 7 [(gogoproto.jsontag) = "view"];
  137. }
  138. message UserInfo {
  139. UserBase user_base = 1 [(gogoproto.jsontag) = "user_base,omitempty"];
  140. UserStat user_stat = 2 [(gogoproto.jsontag) = "user_stat,omitempty"];
  141. int32 follow_state = 3 [(gogoproto.jsontag) = "follow_state", (gogoproto.casttype) = "int8"];
  142. string cursor_value = 4 [(gogoproto.jsontag) = "cursor_value"];
  143. }
  144. message LocationItem {
  145. int32 id = 1[(gogoproto.jsontag) = "id"];
  146. int32 pid = 2[(gogoproto.jsontag) = "pid"];
  147. string name = 3[(gogoproto.jsontag) = "name"];
  148. repeated LocationItem child = 4[(gogoproto.jsontag) = "child,omitempty"];
  149. }
  150. message UserVideoView {
  151. int64 mid = 1 [(gogoproto.moretags)='form:"mid"'];
  152. int64 views = 2 [(gogoproto.moretags)='form:"views"'];
  153. }
  154. //message LocationAllReq {
  155. // int64 version = 1[(gogoproto.moretags)='form:"version"'];
  156. //}
  157. //
  158. //message LocationAllReply {
  159. // bool need_update = 1[(gogoproto.jsontag) = "need_update"];
  160. // repeated LocationItem list = 2 [(gogoproto.jsontag) = "list,omitempty"];
  161. //}
  162. //
  163. //service Location {
  164. // rpc LocationAll(LocationAllReq) returns (LocationAllReply);
  165. //}