Explorar el Código

删除帖子和加入ip

huangguangrong hace 9 meses
padre
commit
c6b291b887

+ 23 - 1
proto/slowwild.proto

@@ -160,17 +160,24 @@ message SearchUsernameRes {
     int64 total = 2;
 }
 
+message CreateTag {
+    string name = 1;
+    int64 id = 2;
+}
+
 message CreatePostReq {
     int64 user_id = 1;
     string title = 2;
     string content = 3;
-    repeated int64 tag_ids = 4;
+    repeated CreateTag tags = 4;
     repeated int64 at_user_ids = 5;
     int32 type = 6; //0-图文1-视频
     int32 visibility = 7; //可见性: 0私密 1好友可见 2关注可见 4公开
     repeated string images = 8;
     string video_cover = 9;
     string video_url = 10;
+    string ip = 11;
+    string ip_loc = 12;
 }
 
 message CreatePostRsp {
@@ -299,6 +306,8 @@ message PostCommentReq {
     string content = 3;
     string image = 4;
     int64 at_user_id = 5;
+    string ip = 6;
+    string ip_loc = 7;
 }
 
 message PostCommentRsp {
@@ -311,6 +320,8 @@ message PostReplyReq {
     string content = 3;
     string image = 4;
     int64 at_user_id = 5;
+    string ip = 6;
+    string ip_loc = 7;
 }
 
 message PostReplyRsp {
@@ -385,6 +396,15 @@ message PostCommentThumbsDownRsp {
     bool success = 1;
 }
 
+message PostDeleteReq {
+    int64 user_id = 1;
+    int64 post_id = 2;
+}
+
+message PostDeleteRsp {
+    bool success = 1;
+}
+
 service SlowWildServer {
     // 用户登录
     rpc Login(LoginReq) returns (LoginAndRegisterRsp);
@@ -434,4 +454,6 @@ service SlowWildServer {
     rpc PostCommentUpvote (PostCommentUpvoteReq) returns (PostCommentUpvoteRsp);
     // 评论点踩
     rpc PostCommentThumbsDown (PostCommentThumbsDownReq) returns (PostCommentThumbsDownRsp);
+    // 删除帖子
+    rpc PostDelete (PostDeleteReq) returns (PostDeleteRsp);
 }

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 207 - 104
slowwild/slowwildserver/slowwild.pb.go


+ 40 - 0
slowwild/slowwildserver/slowwild_grpc.pb.go

@@ -43,6 +43,7 @@ const (
 	SlowWildServer_GetReplyList_FullMethodName          = "/slowwildserver.SlowWildServer/GetReplyList"
 	SlowWildServer_PostCommentUpvote_FullMethodName     = "/slowwildserver.SlowWildServer/PostCommentUpvote"
 	SlowWildServer_PostCommentThumbsDown_FullMethodName = "/slowwildserver.SlowWildServer/PostCommentThumbsDown"
+	SlowWildServer_PostDelete_FullMethodName            = "/slowwildserver.SlowWildServer/PostDelete"
 )
 
 // SlowWildServerClient is the client API for SlowWildServer service.
@@ -97,6 +98,8 @@ type SlowWildServerClient interface {
 	PostCommentUpvote(ctx context.Context, in *PostCommentUpvoteReq, opts ...grpc.CallOption) (*PostCommentUpvoteRsp, error)
 	// 评论点踩
 	PostCommentThumbsDown(ctx context.Context, in *PostCommentThumbsDownReq, opts ...grpc.CallOption) (*PostCommentThumbsDownRsp, error)
+	// 删除帖子
+	PostDelete(ctx context.Context, in *PostDeleteReq, opts ...grpc.CallOption) (*PostDeleteRsp, error)
 }
 
 type slowWildServerClient struct {
@@ -347,6 +350,16 @@ func (c *slowWildServerClient) PostCommentThumbsDown(ctx context.Context, in *Po
 	return out, nil
 }
 
+func (c *slowWildServerClient) PostDelete(ctx context.Context, in *PostDeleteReq, opts ...grpc.CallOption) (*PostDeleteRsp, error) {
+	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+	out := new(PostDeleteRsp)
+	err := c.cc.Invoke(ctx, SlowWildServer_PostDelete_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
@@ -399,6 +412,8 @@ type SlowWildServerServer interface {
 	PostCommentUpvote(context.Context, *PostCommentUpvoteReq) (*PostCommentUpvoteRsp, error)
 	// 评论点踩
 	PostCommentThumbsDown(context.Context, *PostCommentThumbsDownReq) (*PostCommentThumbsDownRsp, error)
+	// 删除帖子
+	PostDelete(context.Context, *PostDeleteReq) (*PostDeleteRsp, error)
 	mustEmbedUnimplementedSlowWildServerServer()
 }
 
@@ -478,6 +493,9 @@ func (UnimplementedSlowWildServerServer) PostCommentUpvote(context.Context, *Pos
 func (UnimplementedSlowWildServerServer) PostCommentThumbsDown(context.Context, *PostCommentThumbsDownReq) (*PostCommentThumbsDownRsp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method PostCommentThumbsDown not implemented")
 }
+func (UnimplementedSlowWildServerServer) PostDelete(context.Context, *PostDeleteReq) (*PostDeleteRsp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method PostDelete not implemented")
+}
 func (UnimplementedSlowWildServerServer) mustEmbedUnimplementedSlowWildServerServer() {}
 
 // UnsafeSlowWildServerServer may be embedded to opt out of forward compatibility for this service.
@@ -923,6 +941,24 @@ func _SlowWildServer_PostCommentThumbsDown_Handler(srv interface{}, ctx context.
 	return interceptor(ctx, in, info, handler)
 }
 
+func _SlowWildServer_PostDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(PostDeleteReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(SlowWildServerServer).PostDelete(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: SlowWildServer_PostDelete_FullMethodName,
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(SlowWildServerServer).PostDelete(ctx, req.(*PostDeleteReq))
+	}
+	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)
@@ -1026,6 +1062,10 @@ var SlowWildServer_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "PostCommentThumbsDown",
 			Handler:    _SlowWildServer_PostCommentThumbsDown_Handler,
 		},
+		{
+			MethodName: "PostDelete",
+			Handler:    _SlowWildServer_PostDelete_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "proto/slowwild.proto",

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio