slowwild.proto 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  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. message CreateTag {
  143. string name = 1;
  144. int64 id = 2;
  145. }
  146. message CreatePostReq {
  147. string title = 2;
  148. string content = 3;
  149. repeated CreateTag tags = 4;
  150. repeated int64 at_user_ids = 5;
  151. int32 type = 6; //0-图文1-视频
  152. int32 visibility = 7; //可见性: 0私密 1好友可见 2关注可见 4公开
  153. repeated string images = 8;
  154. string video_cover = 9;
  155. string video_url = 10;
  156. string ip = 11;
  157. string ip_loc = 12;
  158. }
  159. message CreatePostRsp {
  160. int64 post_id = 1;
  161. }
  162. message GetTagListReq {
  163. int32 page = 1;
  164. int32 page_size = 2;
  165. string tag_name = 3;
  166. int32 sort_by = 4; //排序方式0-创建时间1-热度
  167. }
  168. message TagItem {
  169. string name = 1;
  170. int64 hot_num = 2;
  171. UserInfo user = 3;
  172. int64 id = 4;
  173. int64 created_on = 5;
  174. }
  175. message GetTagListRsp {
  176. repeated TagItem tag_list = 1;
  177. int32 total = 2;
  178. }
  179. message GetTagReq {
  180. int64 tag_id = 1;
  181. }
  182. message GetTagRsp {
  183. string name = 1;
  184. int64 hot_num = 2;
  185. UserInfo user = 3;
  186. int64 id = 4;
  187. int64 created_on = 5;
  188. int64 post_count = 6;
  189. int64 follow_count = 7;
  190. bool is_followed = 8;
  191. }
  192. message GetPostListReq {
  193. int32 page = 1;
  194. int32 page_size = 2;
  195. int32 search_type = 3; // 0-默认搜索1-搜索内容/标题2-话题搜索
  196. int32 sort_type = 4; //0-默认创建时间排序1-热度排序
  197. string keyword = 5; // 搜索关键字,或者对应的id
  198. }
  199. message GetPostListItem {
  200. int64 id = 1;
  201. UserInfo user = 2;
  202. string title = 3;
  203. string content_summary = 4;
  204. int32 post_type = 5; //帖子类型0-普通图文1-视频
  205. int64 comment_count = 6;
  206. int64 upvote_count = 7;
  207. int64 collection_count = 8;
  208. int64 share_count = 9;
  209. int32 visibillity = 10;
  210. string ip_loc = 11;
  211. int64 hot_num = 12;
  212. repeated string images = 13;
  213. string video_url = 14;
  214. string video_cover = 15;
  215. int64 created_on = 16;
  216. repeated TagItem tags = 17;
  217. bool is_liked = 18;
  218. bool is_collected = 19;
  219. bool is_mine = 20;
  220. }
  221. message GetPostListRsp {
  222. repeated GetPostListItem List = 1;
  223. int64 total = 2;
  224. }
  225. message GetPostReq {
  226. int64 post_id = 2;
  227. }
  228. message GetPostRsp {
  229. int64 id = 1;
  230. UserInfo user = 2;
  231. string title = 3;
  232. string content_summary = 4;
  233. int32 post_type = 5; //帖子类型0-普通图文1-视频
  234. int64 comment_count = 6;
  235. int64 upvote_count = 7;
  236. int64 collection_count = 8;
  237. int64 share_count = 9;
  238. int32 visibillity = 10;
  239. string ip_loc = 11;
  240. int64 hot_num = 12;
  241. repeated string images = 13;
  242. string video_url = 14;
  243. string video_cover = 15;
  244. string content = 16;
  245. int64 created_on = 17;
  246. repeated TagItem tags = 18;
  247. repeated UserInfo with_user = 19;
  248. int64 latest_replied_on = 20;
  249. bool is_liked = 21;
  250. bool is_collected = 22;
  251. bool is_mine = 23;
  252. }
  253. message PostUpvoteReq {
  254. int64 post_id = 1;
  255. }
  256. message PostUpvoteRsp {
  257. bool success = 1;
  258. }
  259. message PostCollectionReq {
  260. int64 post_id = 1;
  261. }
  262. message PostCollectionRsp {
  263. bool success = 1;
  264. }
  265. message PostShareReq {
  266. int64 post_id = 1;
  267. }
  268. message PostShareRsp {
  269. bool success = 1;
  270. }
  271. message PostCommentReq {
  272. int64 post_id = 1;
  273. string content = 3;
  274. string image = 4;
  275. int64 at_user_id = 5;
  276. string ip = 6;
  277. string ip_loc = 7;
  278. }
  279. message PostCommentRsp {
  280. int64 comment_id = 1;
  281. }
  282. message PostReplyReq {
  283. int64 post_id = 1;
  284. string content = 3;
  285. string image = 4;
  286. int64 at_user_id = 5;
  287. string ip = 6;
  288. string ip_loc = 7;
  289. int64 comment_id = 8;
  290. int64 to_reply_id = 9;
  291. }
  292. message PostReplyRsp {
  293. int64 reply_id = 1;
  294. }
  295. message GetPostCommentListReq {
  296. int32 page = 1;
  297. int32 page_size = 2;
  298. int64 post_id = 3;
  299. }
  300. message RepliesItem {
  301. int64 id = 1;
  302. int64 post_id = 2;
  303. UserInfo user = 3;
  304. string ip_loc = 4;
  305. string content = 5;
  306. string image = 6;
  307. repeated UserInfo with_user = 7;
  308. int64 upvote_count = 8;
  309. bool is_liked = 9;
  310. bool is_mine = 10;
  311. int64 created_on = 13;
  312. }
  313. message CommentItem {
  314. int64 id = 1;
  315. int64 post_id = 2;
  316. UserInfo user = 3;
  317. string ip_loc = 4;
  318. string content = 5;
  319. string image = 6;
  320. repeated UserInfo with_user = 7;
  321. int64 reply_count = 8;
  322. int64 upvote_count = 9;
  323. repeated RepliesItem reply_item = 10;
  324. bool is_liked = 11;
  325. bool is_mine = 12;
  326. int64 created_on = 13;
  327. }
  328. message GetPostCommentListRsp {
  329. repeated CommentItem list = 1;
  330. int64 total = 2;
  331. }
  332. message GetReplyListReq {
  333. int32 page = 1;
  334. int32 page_size = 2;
  335. int64 comment_id = 3;
  336. }
  337. message GetReplyListRsp {
  338. repeated RepliesItem list = 1;
  339. int64 total = 2;
  340. }
  341. message PostCommentUpvoteReq {
  342. int64 comment_id = 2;
  343. int32 comment_type = 3; // 0- 评论1-回复
  344. }
  345. message PostCommentUpvoteRsp {
  346. bool success = 1;
  347. }
  348. message PostDeleteReq {
  349. int64 post_id = 2;
  350. }
  351. message PostDeleteRsp {
  352. bool success = 1;
  353. }
  354. message CommentDeleteReq {
  355. int64 comment_id = 2;
  356. int32 comment_type = 3; // 0-评论1-回复
  357. }
  358. message CommentDeleteRsp {
  359. bool success = 1;
  360. }
  361. message GetUserPostListReq {
  362. int64 page = 2;
  363. int64 page_size = 3;
  364. int64 query_user_id = 4;
  365. }
  366. message GetUserPostListRsp {
  367. repeated GetPostListItem List = 1;
  368. int64 total = 2;
  369. }
  370. message GetUserPostCollectionListReq {
  371. int64 page = 2;
  372. int64 page_size = 3;
  373. int64 query_user_id = 4;
  374. }
  375. message GetUserPostCollectionListRsp {
  376. repeated GetPostListItem List = 1;
  377. int64 total = 2;
  378. }
  379. message GetUserPostLikeListReq {
  380. int64 page = 2;
  381. int64 page_size = 3;
  382. int64 query_user_id = 4;
  383. }
  384. message GetUserPostLikeListRsp {
  385. repeated GetPostListItem List = 1;
  386. int64 total = 2;
  387. }
  388. service SlowWildServer {
  389. // 用户登录
  390. rpc Login(LoginReq) returns (LoginAndRegisterRsp);
  391. // 用户注册
  392. rpc Register(RegisterReq) returns (LoginAndRegisterRsp);
  393. // 获取用户信息
  394. rpc GetUserInfo(GetUserInfoReq) returns (GetUserInfoResp);
  395. // 查询用户信息
  396. rpc FindUser(FindUserReq) returns (FindUserResp);
  397. // 关注用户
  398. rpc UserFollow (FollowUserReq) returns (FollowUserRes);
  399. // 取消关注用户
  400. rpc UnUserFollow (UnFollowUserReq) returns (UnFollowUserRes);
  401. // 获取我得粉丝
  402. rpc GetFans (GetFollowingReq) returns (GetFollowingRes);
  403. // 查询我的关注
  404. rpc GetFollows (GetFollowingReq) returns (GetFollowingRes);
  405. // 查询用户的详细信息
  406. rpc GetUserProfile (GetUserProfileReq) returns (GetUserProfileRes);
  407. // 搜索用户名称
  408. rpc SearchUsername (SearchUsernameReq) returns (SearchUsernameRes);
  409. // 发布帖子
  410. rpc CreatePost (CreatePostReq) returns (CreatePostRsp);
  411. // 获取话题列表
  412. rpc GetTagList (GetTagListReq) returns (GetTagListRsp);
  413. // 获取话题详情
  414. rpc GetTag (GetTagReq) returns (GetTagRsp);
  415. // 获取帖子列表
  416. rpc GetPostList (GetPostListReq) returns (GetPostListRsp);
  417. // 获取帖子详情
  418. rpc GetPost (GetPostReq) returns (GetPostRsp);
  419. // 点赞帖子
  420. rpc PostUpvote (PostUpvoteReq) returns (PostUpvoteRsp);
  421. // 分享帖子
  422. rpc PostShare (PostShareReq) returns (PostShareRsp);
  423. // 收藏帖子
  424. rpc PostCollection (PostCollectionReq) returns (PostCollectionRsp);
  425. // 发布评论
  426. rpc PostComment (PostCommentReq) returns (PostCommentRsp);
  427. // 发布回复
  428. rpc PostReply (PostReplyReq) returns (PostReplyRsp);
  429. // 获取评论列表
  430. rpc GetPostCommentList (GetPostCommentListReq) returns (GetPostCommentListRsp);
  431. // 获取回复列表
  432. rpc GetReplyList (GetReplyListReq) returns (GetReplyListRsp);
  433. // 评论点赞
  434. rpc PostCommentUpvote (PostCommentUpvoteReq) returns (PostCommentUpvoteRsp);
  435. // 删除帖子
  436. rpc PostDelete (PostDeleteReq) returns (PostDeleteRsp);
  437. // 删除回复/评论
  438. rpc CommentDelete (CommentDeleteReq) returns (CommentDeleteRsp);
  439. // 获取用户发布的帖子
  440. rpc GetUserPostList (GetUserPostListReq) returns (GetUserPostListRsp);
  441. // 获取用户收藏的帖子
  442. rpc GetUserPostCollectionList (GetUserPostCollectionListReq) returns (GetUserPostCollectionListRsp);
  443. // 获取用户点赞过的帖子
  444. rpc GetUserPostLikeList (GetUserPostLikeListReq) returns (GetUserPostLikeListRsp);
  445. }