slow_wild.md 15 KB

1. "登录方法"

  1. route definition
  • Url: /api/user/login
  • Method: POST
  • Request: LoginReq
  • Response: LoginAndRegisterRsp
  1. request definition

    type LoginReq struct {
    	Phone string `json:"phone"`
    	Password string `json:"password"`
    	Code string `json:"code"`
    	Login_type int32 `json:"login_type"`
    	Login_ip string `json:"login_ip"`
    }
    
  2. response definition

    type LoginAndRegisterRsp struct {
    	Token string `json:"token"`
    	Expire int64 `json:"expire"`
    }
    

2. "用户注册"

  1. route definition
  • Url: /api/user/register
  • Method: POST
  • Request: RegisterReq
  • Response: LoginAndRegisterRsp
  1. request definition

    type RegisterReq struct {
    	Phone string `json:"phone"`
    	Nickname string `json:"nickname"`
    	Password string `json:"password"`
    	Avatar string `json:"avatar"`
    	Sex int32 `json:"sex"`
    	Username string `json:"username"`
    	Code string `json:"code"`
    }
    
  2. response definition

    type LoginAndRegisterRsp struct {
    	Token string `json:"token"`
    	Expire int64 `json:"expire"`
    }
    

3. "获取粉丝"

  1. route definition
  • Url: /api/user/fans
  • Method: GET
  • Request: GetFollowingReq
  • Response: GetFollowingRes
  1. request definition

    type GetFollowingReq struct {
    	User_id int64 `json:"user_id"`
    	Page_size int32 `json:"page_size"`
    	Page int32 `json:"page"`
    	Query_user_id int64 `json:"query_user_id"`
    }
    
  2. response definition

    type GetFollowingRes struct {
    	List []FollowUserInfo `json:"list"`
    	Total int64 `json:"total"`
    }
    

4. "查询用户"

  1. route definition
  • Url: /api/user/find
  • Method: POST
  • Request: FindUserReq
  • Response: FindUserResp
  1. request definition

    type FindUserReq struct {
    	Username string `json:"username"`
    	Phone string `json:"phone"`
    	Ids []int64 `json:"ids"`
    }
    
  2. response definition

    type FindUserResp struct {
    	User_list []UserInfo `json:"user_list"`
    }
    

5. "关注用户"

  1. route definition
  • Url: /api/user/follow
  • Method: POST
  • Request: FollowUserReq
  • Response: FollowUserRes
  1. request definition

    type FollowUserReq struct {
    	User_id int64 `json:"user_id"`
    	Follow_user_id int64 `json:"follow_user_id"`
    }
    
  2. response definition

    type FollowUserRes struct {
    	Success bool `json:"success"`
    }
    

6. "获取关注列表"

  1. route definition
  • Url: /api/user/follows
  • Method: GET
  • Request: GetFollowReq
  • Response: GetFollowRes
  1. request definition

    type GetFollowReq struct {
    	User_id int64 `json:"user_id"`
    	Page_size int32 `json:"page_size"`
    	Page int32 `json:"page"`
    	Query_user_id int64 `json:"query_user_id"`
    }
    
  2. response definition

    type GetFollowRes struct {
    	List []FollowUserInfo `json:"list"`
    	Total int64 `json:"total"`
    }
    

7. "获取用户信息"

  1. route definition
  • Url: /api/user/info
  • Method: GET
  • Request: GetUserInfoReq
  • Response: GetUserInfoResp
  1. request definition

    type GetUserInfoReq struct {
    	User_id int64 `json:"user_id"`
    	Query_user_id int64 `json:"query_user_id"`
    }
    
  2. response definition

    type GetUserInfoResp struct {
    	Id int64 `json:"id"`
    	Avatar string `json:"avatar"`
    	Nickname string `json:"nickname"`
    	Sex int32 `json:"sex"`
    	Is_follow bool `json:"is_follow"`
    }
    

8. "获取用户信息"

  1. route definition
  • Url: /api/user/profile
  • Method: GET
  • Request: GetUserProfileReq
  • Response: GetUserProfileRes
  1. request definition

    type GetUserProfileReq struct {
    	User_id int64 `json:"user_id"`
    }
    
  2. response definition

    type GetUserProfileRes struct {
    	Id int64 `json:"id"`
    	Nickname string `json:"nickname"`
    	Username string `json:"username"`
    	Status int32 `json:"status"`
    	Avatar string `json:"avatar"`
    	Phone string `json:"phone"`
    	Tweet_count int32 `json:"tweet_count"`
    	Is_following bool `json:"is_following"`
    	Created_on int64 `json:"created_on"`
    	Follows int64 `json:"follows"`
    	Fans int64 `json:"fans"`
    	Get_likes_count int32 `json:"get_likes_count"`
    	Get_collection_count int32 `json:"get_collection_count"`
    	Sex int32 `json:"sex"`
    }
    

9. "搜索用户"

  1. route definition
  • Url: /api/user/search
  • Method: GET
  • Request: SearchUsernameReq
  • Response: SearchUsernameRes
  1. request definition

    type SearchUsernameReq struct {
    	Keyword string `json:"keyword"`
    	Page int32 `json:"page"`
    	Page_size int32 `json:"page_size"`
    	User_id int64 `json:"user_id"`
    }
    
  2. response definition

    type SearchUsernameRes struct {
    	List []SearchUsernameItem `json:"list"`
    	Total int64 `json:"total"`
    }
    

10. "取消关注用户"

  1. route definition
  • Url: /api/user/unfollow
  • Method: POST
  • Request: UnFollowUserReq
  • Response: UnFollowUserRes
  1. request definition

    type UnFollowUserReq struct {
    	User_id int64 `json:"user_id"`
    	Un_follow_user_id int64 `json:"un_follow_user_id"`
    }
    
  2. response definition

    type UnFollowUserRes struct {
    	Success bool `json:"success"`
    }
    

11. "评论删除"

  1. route definition
  • Url: /api/comment/delete
  • Method: POST
  • Request: CommentDeleteReq
  • Response: CommentDeleteRsp
  1. request definition

    type CommentDeleteReq struct {
    	User_id int64 `json:"user_id"`
    	Comment_id int64 `json:"comment_id"`
    	Comment_type int32 `json:"comment_type"`
    }
    
  2. response definition

    type CommentDeleteRsp struct {
    	Success bool `json:"success"`
    }
    

12. "帖子收藏"

  1. route definition
  • Url: /api/post/collection
  • Method: POST
  • Request: PostCollectionReq
  • Response: PostCollectionRsp
  1. request definition

    type PostCollectionReq struct {
    	Post_id int64 `json:"post_id"`
    	User_id int64 `json:"user_id"`
    }
    
  2. response definition

    type PostCollectionRsp struct {
    	Success bool `json:"success"`
    }
    

13. "发布评论"

  1. route definition
  • Url: /api/post/comment
  • Method: POST
  • Request: PostCommentReq
  • Response: PostCommentRsp
  1. request definition

    type PostCommentReq struct {
    	Post_id int64 `json:"post_id"`
    	User_id int64 `json:"user_id"`
    	Content string `json:"content"`
    	Image string `json:"image"`
    	At_user_id int64 `json:"at_user_id"`
    	Ip string `json:"ip"`
    	Ip_loc string `json:"ip_loc"`
    }
    
  2. response definition

    type PostCommentRsp struct {
    	Comment_id int64 `json:"comment_id"`
    }
    

14. "评论点赞"

  1. route definition
  • Url: /api/post/comment/upvote
  • Method: POST
  • Request: PostCommentUpvoteReq
  • Response: PostCommentUpvoteRsp
  1. request definition

    type PostCommentUpvoteReq struct {
    	User_id int64 `json:"user_id"`
    	Comment_id int64 `json:"comment_id"`
    	Comment_type int32 `json:"comment_type"`
    }
    
  2. response definition

    type PostCommentUpvoteRsp struct {
    	Success bool `json:"success"`
    }
    

15. "创建帖子"

  1. route definition
  • Url: /api/post/create
  • Method: POST
  • Request: CreatePostReq
  • Response: CreatePostRsp
  1. request definition

    type CreatePostReq struct {
    	User_id int64 `json:"user_id"`
    	Title string `json:"title"`
    	Content string `json:"content"`
    	Tags []CreateTag `json:"tags"`
    	At_user_ids []int64 `json:"at_user_ids"`
    	Post_type int32 `json:"post_type"`
    	Visibility int32 `json:"visibility"`
    	Images []string `json:"images"`
    	Video_cover string `json:"video_cover"`
    	Video_url string `json:"video_url"`
    	Ip string `json:"ip"`
    	Ip_loc string `json:"ip_loc"`
    }
    
  2. response definition

    type CreatePostRsp struct {
    	Post_id int64 `json:"post_id"`
    }
    

16. "帖子删除"

  1. route definition
  • Url: /api/post/delete
  • Method: POST
  • Request: PostDeleteReq
  • Response: PostDeleteRsp
  1. request definition

    type PostDeleteReq struct {
    	User_id int64 `json:"user_id"`
    	Post_id int64 `json:"post_id"`
    }
    
  2. response definition

    type PostDeleteRsp struct {
    	Success bool `json:"success"`
    }
    

17. "回复评论"

  1. route definition
  • Url: /api/post/reply
  • Method: POST
  • Request: PostReplyReq
  • Response: PostReplyRsp
  1. request definition

    type PostReplyReq struct {
    	Post_id int64 `json:"post_id"`
    	User_id int64 `json:"user_id"`
    	Content string `json:"content"`
    	Image string `json:"image"`
    	At_user_id int64 `json:"at_user_id"`
    	Ip string `json:"ip"`
    	Ip_loc string `json:"ip_loc"`
    	Comment_id int64 `json:"comment_id"`
    	To_reply_id int64 `json:"to_reply_id"`
    }
    
  2. response definition

    type PostReplyRsp struct {
    	Reply_id int64 `json:"reply_id"`
    }
    

18. "帖子分享"

  1. route definition
  • Url: /api/post/share
  • Method: POST
  • Request: PostShareReq
  • Response: PostShareRsp
  1. request definition

    type PostShareReq struct {
    	Post_id int64 `json:"post_id"`
    	User_id int64 `json:"user_id"`
    }
    
  2. response definition

    type PostShareRsp struct {
    	Success bool `json:"success"`
    }
    

19. "帖子点赞"

  1. route definition
  • Url: /api/post/upvote
  • Method: POST
  • Request: PostUpvoteReq
  • Response: PostUpvoteRsp
  1. request definition

    type PostUpvoteReq struct {
    	Post_id int64 `json:"post_id"`
    	User_id int64 `json:"user_id"`
    }
    
  2. response definition

    type PostUpvoteRsp struct {
    	Success bool `json:"success"`
    }
    

20. "获取帖子详情"

  1. route definition
  • Url: /api/post
  • Method: GET
  • Request: GetPostReq
  • Response: GetPostRsp
  1. request definition

    type GetPostReq struct {
    	User_id int64 `json:"user_id"`
    	Post_id int64 `json:"post_id"`
    }
    
  2. response definition

    type GetPostRsp struct {
    	Id int64 `json:"id"`
    	User UserInfo `json:"user"`
    	Title string `json:"title"`
    	Content_summary string `json:"content_summary"`
    	Post_type int32 `json:"post_type"`
    	Comment_count int64 `json:"comment_count"`
    	Upvote_count int64 `json:"upvote_count"`
    	Collection_count int64 `json:"collection_count"`
    	Share_count int64 `json:"share_count"`
    	Visibility int32 `json:"visibility"`
    	Ip_loc string `json:"ip_loc"`
    	Hot_num int64 `json:"hot_num"`
    	Images []string `json:"images"`
    	Video_url string `json:"video_url"`
    	Video_cover string `json:"video_cover"`
    	Content string `json:"content"`
    	Created_on int64 `json:"created_on"`
    	Tags []TagItem `json:"tags"`
    	With_user []UserInfo `json:"with_user"`
    	Latest_replied_on int64 `json:"latest_replied_on"`
    	Is_liked bool `json:"is_liked"`
    	Is_collected bool `json:"is_collected"`
    	Is_mine bool `json:"is_mine"`
    }
    
    type UserInfo struct {
    	Id int64 `json:"id"`
    	Avatar string `json:"avatar"`
    	Nickname string `json:"nickname"`
    	Sex int32 `json:"sex"`
    }
    

21. "获取评论列表"

  1. route definition
  • Url: /api/post/comment/list
  • Method: GET
  • Request: GetPostCommentListReq
  • Response: GetPostCommentListRsp
  1. request definition

    type GetPostCommentListReq struct {
    	Page int32 `json:"page"`
    	Page_size int32 `json:"page_size"`
    	Post_id int64 `json:"post_id"`
    	User_id int64 `json:"user_id"`
    }
    
  2. response definition

    type GetPostCommentListRsp struct {
    	List []CommentItem `json:"list"`
    	Total int64 `json:"total"`
    }
    

22. "获取帖子列表"

  1. route definition
  • Url: /api/post/list
  • Method: GET
  • Request: GetPostListReq
  • Response: GetPostListRsp
  1. request definition

    type GetPostListReq struct {
    	Page int32 `json:"page"`
    	Page_size int32 `json:"page_size"`
    	Search_type int32 `json:"search_type"`
    	Sort_type int32 `json:"sort_type"`
    	Keyword string `json:"keyword"`
    	User_id int64 `json:"user_id"`
    }
    
  2. response definition

    type GetPostListRsp struct {
    	List []GetPostListItem `json:"list"`
    	Total int64 `json:"total"`
    }
    

23. "获取回复列表"

  1. route definition
  • Url: /api/post/reply/list
  • Method: GET
  • Request: GetReplyListReq
  • Response: GetReplyListRsp
  1. request definition

    type GetReplyListReq struct {
    	Page int32 `json:"page"`
    	Page_size int32 `json:"page_size"`
    	Comment_id int64 `json:"comment_id"`
    	User_id int64 `json:"user_id"`
    }
    
  2. response definition

    type GetReplyListRsp struct {
    	List []RepliesItem `json:"list"`
    	Total int64 `json:"total"`
    }
    

24. "获取话题详情"

  1. route definition
  • Url: /api/tag
  • Method: GET
  • Request: GetTagReq
  • Response: GetTagRsp
  1. request definition

    type GetTagReq struct {
    	Tag_id int64 `json:"tag_id"`
    	User_id int64 `json:"user_id"`
    }
    
  2. response definition

    type GetTagRsp struct {
    	Name string `json:"name"`
    	Hot_num int64 `json:"hot_num"`
    	User UserInfo `json:"user"`
    	Id int64 `json:"id"`
    	Created_on int64 `json:"created_on"`
    	Post_count int64 `json:"post_count"`
    	Follow_count int64 `json:"follow_count"`
    	Is_followed bool `json:"is_followed"`
    }
    
    type UserInfo struct {
    	Id int64 `json:"id"`
    	Avatar string `json:"avatar"`
    	Nickname string `json:"nickname"`
    	Sex int32 `json:"sex"`
    }
    

25. "获取话题列表"

  1. route definition
  • Url: /api/tag/list
  • Method: GET
  • Request: GetTagListReq
  • Response: GetTagListRsp
  1. request definition

    type GetTagListReq struct {
    	Page int32 `json:"page"`
    	Page_size int32 `json:"page_size"`
    	Tag_name string `json:"tag_name"`
    	Sort_by int32 `json:"sort_by"`
    }
    
  2. response definition

    type GetTagListRsp struct {
    	Tag_list []TagItem `json:"tag_list"`
    	Total int32 `json:"total"`
    }
    

26. "获取用户收藏的帖子列表"

  1. route definition
  • Url: /api/user/post/collection/list
  • Method: GET
  • Request: GetUserPostCollectionListReq
  • Response: GetUserPostCollectionListRsp
  1. request definition

    type GetUserPostCollectionListReq struct {
    	User_id int64 `json:"user_id"`
    	Page int64 `json:"page"`
    	Page_size int64 `json:"page_size"`
    	Query_user_id int64 `json:"query_user_id"`
    }
    
  2. response definition

    type GetUserPostCollectionListRsp struct {
    	List []GetPostListItem `json:"list"`
    	Total int64 `json:"total"`
    }
    

27. "获取用户点赞的帖子列表"

  1. route definition
  • Url: /api/user/post/like/list
  • Method: GET
  • Request: GetUserPostLikeListReq
  • Response: GetUserPostLikeListRsp
  1. request definition

    type GetUserPostLikeListReq struct {
    	User_id int64 `json:"user_id"`
    	Page int64 `json:"page"`
    	Page_size int64 `json:"page_size"`
    	Query_user_id int64 `json:"query_user_id"`
    }
    
  2. response definition

    type GetUserPostLikeListRsp struct {
    	List []GetPostListItem `json:"list"`
    	Total int64 `json:"total"`
    }
    

28. "获取用户发布的帖子列表"

  1. route definition
  • Url: /api/user/post/list
  • Method: GET
  • Request: GetUserPostListReq
  • Response: GetUserPostListRsp
  1. request definition

    type GetUserPostListReq struct {
    	User_id int64 `json:"user_id"`
    	Page int64 `json:"page"`
    	Page_size int64 `json:"page_size"`
    	Query_user_id int64 `json:"query_user_id"`
    }
    
  2. response definition

    type GetUserPostListRsp struct {
    	List []GetPostListItem `json:"list"`
    	Total int64 `json:"total"`
    }