Kaynağa Gözat

获取用户发的帖子

huangguangrong 9 ay önce
ebeveyn
işleme
03d242ae4c

+ 43 - 0
proto/slowwild.proto

@@ -428,6 +428,43 @@ message CommentDeleteRsp {
     bool success = 1;
 }
 
+message GetUserPostListReq {
+    int64 user_id = 1; // 当前登陆用户
+    int64 page = 2;
+    int64 page_size = 3;
+    int64 query_user_id = 4;
+}
+
+message GetUserPostListRsp {
+    repeated GetPostListItem List = 1;
+    int64 total = 2;
+}
+
+
+message GetUserPostCollectionListReq {
+    int64 user_id = 1; // 当前登陆用户
+    int64 page = 2;
+    int64 page_size = 3;
+    int64 query_user_id = 4;
+}
+
+message GetUserPostCollectionListRsp {
+    repeated GetPostListItem List = 1;
+    int64 total = 2;
+}
+
+message GetUserPostLikeListReq {
+    int64 user_id = 1; // 当前登陆用户
+    int64 page = 2;
+    int64 page_size = 3;
+    int64 query_user_id = 4;
+}
+
+message GetUserPostLikeListRsp {
+    repeated GetPostListItem List = 1;
+    int64 total = 2;
+}
+
 service SlowWildServer {
     // 用户登录
     rpc Login(LoginReq) returns (LoginAndRegisterRsp);
@@ -479,4 +516,10 @@ service SlowWildServer {
     rpc PostDelete (PostDeleteReq) returns (PostDeleteRsp);
     // 删除回复/评论
     rpc CommentDelete (CommentDeleteReq) returns (CommentDeleteRsp);
+    // 获取用户发布的帖子
+    rpc GetUserPostList (GetUserPostLikeListReq) returns (GetUserPostListRsp);
+    // 获取用户收藏的帖子
+    rpc GetUserPostCollectionList (GetUserPostCollectionListReq) returns (GetUserPostCollectionListRsp);
+    // 获取用户点赞过的帖子
+    rpc GetUserPostLikeList (GetUserPostLikeListReq) returns (GetUserPostLikeListRsp);
 }

Dosya farkı çok büyük olduğundan ihmal edildi
+ 765 - 235
slowwild/slowwildserver/slowwild.pb.go


+ 145 - 25
slowwild/slowwildserver/slowwild_grpc.pb.go

@@ -19,31 +19,34 @@ import (
 const _ = grpc.SupportPackageIsVersion8
 
 const (
-	SlowWildServer_Login_FullMethodName              = "/slowwildserver.SlowWildServer/Login"
-	SlowWildServer_Register_FullMethodName           = "/slowwildserver.SlowWildServer/Register"
-	SlowWildServer_GetUserInfo_FullMethodName        = "/slowwildserver.SlowWildServer/GetUserInfo"
-	SlowWildServer_FindUser_FullMethodName           = "/slowwildserver.SlowWildServer/FindUser"
-	SlowWildServer_UserFollow_FullMethodName         = "/slowwildserver.SlowWildServer/UserFollow"
-	SlowWildServer_UnUserFollow_FullMethodName       = "/slowwildserver.SlowWildServer/UnUserFollow"
-	SlowWildServer_GetFans_FullMethodName            = "/slowwildserver.SlowWildServer/GetFans"
-	SlowWildServer_GetFollows_FullMethodName         = "/slowwildserver.SlowWildServer/GetFollows"
-	SlowWildServer_GetUserProfile_FullMethodName     = "/slowwildserver.SlowWildServer/GetUserProfile"
-	SlowWildServer_SearchUsername_FullMethodName     = "/slowwildserver.SlowWildServer/SearchUsername"
-	SlowWildServer_CreatePost_FullMethodName         = "/slowwildserver.SlowWildServer/CreatePost"
-	SlowWildServer_GetTagList_FullMethodName         = "/slowwildserver.SlowWildServer/GetTagList"
-	SlowWildServer_GetTag_FullMethodName             = "/slowwildserver.SlowWildServer/GetTag"
-	SlowWildServer_GetPostList_FullMethodName        = "/slowwildserver.SlowWildServer/GetPostList"
-	SlowWildServer_GetPost_FullMethodName            = "/slowwildserver.SlowWildServer/GetPost"
-	SlowWildServer_PostUpvote_FullMethodName         = "/slowwildserver.SlowWildServer/PostUpvote"
-	SlowWildServer_PostShare_FullMethodName          = "/slowwildserver.SlowWildServer/PostShare"
-	SlowWildServer_PostCollection_FullMethodName     = "/slowwildserver.SlowWildServer/PostCollection"
-	SlowWildServer_PostComment_FullMethodName        = "/slowwildserver.SlowWildServer/PostComment"
-	SlowWildServer_PostReply_FullMethodName          = "/slowwildserver.SlowWildServer/PostReply"
-	SlowWildServer_GetPostCommentList_FullMethodName = "/slowwildserver.SlowWildServer/GetPostCommentList"
-	SlowWildServer_GetReplyList_FullMethodName       = "/slowwildserver.SlowWildServer/GetReplyList"
-	SlowWildServer_PostCommentUpvote_FullMethodName  = "/slowwildserver.SlowWildServer/PostCommentUpvote"
-	SlowWildServer_PostDelete_FullMethodName         = "/slowwildserver.SlowWildServer/PostDelete"
-	SlowWildServer_CommentDelete_FullMethodName      = "/slowwildserver.SlowWildServer/CommentDelete"
+	SlowWildServer_Login_FullMethodName                     = "/slowwildserver.SlowWildServer/Login"
+	SlowWildServer_Register_FullMethodName                  = "/slowwildserver.SlowWildServer/Register"
+	SlowWildServer_GetUserInfo_FullMethodName               = "/slowwildserver.SlowWildServer/GetUserInfo"
+	SlowWildServer_FindUser_FullMethodName                  = "/slowwildserver.SlowWildServer/FindUser"
+	SlowWildServer_UserFollow_FullMethodName                = "/slowwildserver.SlowWildServer/UserFollow"
+	SlowWildServer_UnUserFollow_FullMethodName              = "/slowwildserver.SlowWildServer/UnUserFollow"
+	SlowWildServer_GetFans_FullMethodName                   = "/slowwildserver.SlowWildServer/GetFans"
+	SlowWildServer_GetFollows_FullMethodName                = "/slowwildserver.SlowWildServer/GetFollows"
+	SlowWildServer_GetUserProfile_FullMethodName            = "/slowwildserver.SlowWildServer/GetUserProfile"
+	SlowWildServer_SearchUsername_FullMethodName            = "/slowwildserver.SlowWildServer/SearchUsername"
+	SlowWildServer_CreatePost_FullMethodName                = "/slowwildserver.SlowWildServer/CreatePost"
+	SlowWildServer_GetTagList_FullMethodName                = "/slowwildserver.SlowWildServer/GetTagList"
+	SlowWildServer_GetTag_FullMethodName                    = "/slowwildserver.SlowWildServer/GetTag"
+	SlowWildServer_GetPostList_FullMethodName               = "/slowwildserver.SlowWildServer/GetPostList"
+	SlowWildServer_GetPost_FullMethodName                   = "/slowwildserver.SlowWildServer/GetPost"
+	SlowWildServer_PostUpvote_FullMethodName                = "/slowwildserver.SlowWildServer/PostUpvote"
+	SlowWildServer_PostShare_FullMethodName                 = "/slowwildserver.SlowWildServer/PostShare"
+	SlowWildServer_PostCollection_FullMethodName            = "/slowwildserver.SlowWildServer/PostCollection"
+	SlowWildServer_PostComment_FullMethodName               = "/slowwildserver.SlowWildServer/PostComment"
+	SlowWildServer_PostReply_FullMethodName                 = "/slowwildserver.SlowWildServer/PostReply"
+	SlowWildServer_GetPostCommentList_FullMethodName        = "/slowwildserver.SlowWildServer/GetPostCommentList"
+	SlowWildServer_GetReplyList_FullMethodName              = "/slowwildserver.SlowWildServer/GetReplyList"
+	SlowWildServer_PostCommentUpvote_FullMethodName         = "/slowwildserver.SlowWildServer/PostCommentUpvote"
+	SlowWildServer_PostDelete_FullMethodName                = "/slowwildserver.SlowWildServer/PostDelete"
+	SlowWildServer_CommentDelete_FullMethodName             = "/slowwildserver.SlowWildServer/CommentDelete"
+	SlowWildServer_GetUserPostList_FullMethodName           = "/slowwildserver.SlowWildServer/GetUserPostList"
+	SlowWildServer_GetUserPostCollectionList_FullMethodName = "/slowwildserver.SlowWildServer/GetUserPostCollectionList"
+	SlowWildServer_GetUserPostLikeList_FullMethodName       = "/slowwildserver.SlowWildServer/GetUserPostLikeList"
 )
 
 // SlowWildServerClient is the client API for SlowWildServer service.
@@ -100,6 +103,12 @@ type SlowWildServerClient interface {
 	PostDelete(ctx context.Context, in *PostDeleteReq, opts ...grpc.CallOption) (*PostDeleteRsp, error)
 	// 删除回复/评论
 	CommentDelete(ctx context.Context, in *CommentDeleteReq, opts ...grpc.CallOption) (*CommentDeleteRsp, error)
+	// 获取用户发布的帖子
+	GetUserPostList(ctx context.Context, in *GetUserPostLikeListReq, opts ...grpc.CallOption) (*GetUserPostListRsp, error)
+	// 获取用户收藏的帖子
+	GetUserPostCollectionList(ctx context.Context, in *GetUserPostCollectionListReq, opts ...grpc.CallOption) (*GetUserPostCollectionListRsp, error)
+	// 获取用户点赞过的帖子
+	GetUserPostLikeList(ctx context.Context, in *GetUserPostLikeListReq, opts ...grpc.CallOption) (*GetUserPostLikeListRsp, error)
 }
 
 type slowWildServerClient struct {
@@ -360,6 +369,36 @@ func (c *slowWildServerClient) CommentDelete(ctx context.Context, in *CommentDel
 	return out, nil
 }
 
+func (c *slowWildServerClient) GetUserPostList(ctx context.Context, in *GetUserPostLikeListReq, opts ...grpc.CallOption) (*GetUserPostListRsp, error) {
+	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+	out := new(GetUserPostListRsp)
+	err := c.cc.Invoke(ctx, SlowWildServer_GetUserPostList_FullMethodName, in, out, cOpts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *slowWildServerClient) GetUserPostCollectionList(ctx context.Context, in *GetUserPostCollectionListReq, opts ...grpc.CallOption) (*GetUserPostCollectionListRsp, error) {
+	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+	out := new(GetUserPostCollectionListRsp)
+	err := c.cc.Invoke(ctx, SlowWildServer_GetUserPostCollectionList_FullMethodName, in, out, cOpts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *slowWildServerClient) GetUserPostLikeList(ctx context.Context, in *GetUserPostLikeListReq, opts ...grpc.CallOption) (*GetUserPostLikeListRsp, error) {
+	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+	out := new(GetUserPostLikeListRsp)
+	err := c.cc.Invoke(ctx, SlowWildServer_GetUserPostLikeList_FullMethodName, in, out, cOpts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // SlowWildServerServer is the server API for SlowWildServer service.
 // All implementations must embed UnimplementedSlowWildServerServer
 // for forward compatibility
@@ -414,6 +453,12 @@ type SlowWildServerServer interface {
 	PostDelete(context.Context, *PostDeleteReq) (*PostDeleteRsp, error)
 	// 删除回复/评论
 	CommentDelete(context.Context, *CommentDeleteReq) (*CommentDeleteRsp, error)
+	// 获取用户发布的帖子
+	GetUserPostList(context.Context, *GetUserPostLikeListReq) (*GetUserPostListRsp, error)
+	// 获取用户收藏的帖子
+	GetUserPostCollectionList(context.Context, *GetUserPostCollectionListReq) (*GetUserPostCollectionListRsp, error)
+	// 获取用户点赞过的帖子
+	GetUserPostLikeList(context.Context, *GetUserPostLikeListReq) (*GetUserPostLikeListRsp, error)
 	mustEmbedUnimplementedSlowWildServerServer()
 }
 
@@ -496,6 +541,15 @@ func (UnimplementedSlowWildServerServer) PostDelete(context.Context, *PostDelete
 func (UnimplementedSlowWildServerServer) CommentDelete(context.Context, *CommentDeleteReq) (*CommentDeleteRsp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method CommentDelete not implemented")
 }
+func (UnimplementedSlowWildServerServer) GetUserPostList(context.Context, *GetUserPostLikeListReq) (*GetUserPostListRsp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GetUserPostList not implemented")
+}
+func (UnimplementedSlowWildServerServer) GetUserPostCollectionList(context.Context, *GetUserPostCollectionListReq) (*GetUserPostCollectionListRsp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GetUserPostCollectionList not implemented")
+}
+func (UnimplementedSlowWildServerServer) GetUserPostLikeList(context.Context, *GetUserPostLikeListReq) (*GetUserPostLikeListRsp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GetUserPostLikeList not implemented")
+}
 func (UnimplementedSlowWildServerServer) mustEmbedUnimplementedSlowWildServerServer() {}
 
 // UnsafeSlowWildServerServer may be embedded to opt out of forward compatibility for this service.
@@ -959,6 +1013,60 @@ func _SlowWildServer_CommentDelete_Handler(srv interface{}, ctx context.Context,
 	return interceptor(ctx, in, info, handler)
 }
 
+func _SlowWildServer_GetUserPostList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GetUserPostLikeListReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(SlowWildServerServer).GetUserPostList(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: SlowWildServer_GetUserPostList_FullMethodName,
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(SlowWildServerServer).GetUserPostList(ctx, req.(*GetUserPostLikeListReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _SlowWildServer_GetUserPostCollectionList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GetUserPostCollectionListReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(SlowWildServerServer).GetUserPostCollectionList(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: SlowWildServer_GetUserPostCollectionList_FullMethodName,
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(SlowWildServerServer).GetUserPostCollectionList(ctx, req.(*GetUserPostCollectionListReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _SlowWildServer_GetUserPostLikeList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GetUserPostLikeListReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(SlowWildServerServer).GetUserPostLikeList(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: SlowWildServer_GetUserPostLikeList_FullMethodName,
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(SlowWildServerServer).GetUserPostLikeList(ctx, req.(*GetUserPostLikeListReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // SlowWildServer_ServiceDesc is the grpc.ServiceDesc for SlowWildServer service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
@@ -1066,6 +1174,18 @@ var SlowWildServer_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "CommentDelete",
 			Handler:    _SlowWildServer_CommentDelete_Handler,
 		},
+		{
+			MethodName: "GetUserPostList",
+			Handler:    _SlowWildServer_GetUserPostList_Handler,
+		},
+		{
+			MethodName: "GetUserPostCollectionList",
+			Handler:    _SlowWildServer_GetUserPostCollectionList_Handler,
+		},
+		{
+			MethodName: "GetUserPostLikeList",
+			Handler:    _SlowWildServer_GetUserPostLikeList_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "proto/slowwild.proto",

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor