wfz 2 år sedan
förälder
incheckning
7e42eb5f22
3 ändrade filer med 68 tillägg och 22 borttagningar
  1. 28 22
      api/scrip/scrip.pb.go
  2. 2 0
      api/scrip/scrip.proto
  3. 38 0
      api/scrip/scrip_grpc.pb.go

+ 28 - 22
api/scrip/scrip.pb.go

@@ -28,8 +28,8 @@ var file_scrip_proto_rawDesc = []byte{
 	0x70, 0x69, 0x2e, 0x73, 0x63, 0x72, 0x69, 0x70, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
 	0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e,
 	0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f,
-	0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xf7,
-	0x05, 0x0a, 0x05, 0x53, 0x63, 0x72, 0x69, 0x70, 0x12, 0x44, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61,
+	0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xbf,
+	0x06, 0x0a, 0x05, 0x53, 0x63, 0x72, 0x69, 0x70, 0x12, 0x44, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61,
 	0x74, 0x65, 0x53, 0x63, 0x72, 0x69, 0x70, 0x12, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x6f,
 	0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x63, 0x72, 0x69, 0x70,
 	0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x6f,
@@ -76,12 +76,16 @@ var file_scrip_proto_rawDesc = []byte{
 	0x72, 0x69, 0x70, 0x12, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
 	0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16,
 	0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
-	0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, 0x40, 0x0a, 0x09, 0x61, 0x70, 0x69, 0x2e,
-	0x73, 0x63, 0x72, 0x69, 0x70, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x2e, 0x69, 0x6b, 0x75,
-	0x62, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70,
-	0x77, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73,
-	0x63, 0x72, 0x69, 0x70, 0x3b, 0x73, 0x63, 0x72, 0x69, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
-	0x6f, 0x33,
+	0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x12, 0x43, 0x72, 0x6f, 0x6e,
+	0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x6c, 0x64, 0x53, 0x63, 0x72, 0x69, 0x70, 0x12, 0x16,
+	0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
+	0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
+	0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00,
+	0x42, 0x40, 0x0a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x63, 0x72, 0x69, 0x70, 0x50, 0x01, 0x5a,
+	0x31, 0x67, 0x69, 0x74, 0x2e, 0x69, 0x6b, 0x75, 0x62, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
+	0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x77, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
+	0x75, 0x66, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x3b, 0x73, 0x63, 0x72,
+	0x69, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var file_scrip_proto_goTypes = []interface{}{
@@ -94,8 +98,8 @@ var file_scrip_proto_goTypes = []interface{}{
 	(*common.ReplyScripRequest)(nil),      // 6: api.common.ReplyScripRequest
 	(*common.PersonIDParam)(nil),          // 7: api.common.PersonIDParam
 	(*common.ReportRequest)(nil),          // 8: api.common.ReportRequest
-	(*common.ScripID)(nil),                // 9: api.common.ScripID
-	(*emptypb.Empty)(nil),                 // 10: google.protobuf.Empty
+	(*emptypb.Empty)(nil),                 // 9: google.protobuf.Empty
+	(*common.ScripID)(nil),                // 10: api.common.ScripID
 	(*common.ScripReply)(nil),             // 11: api.common.ScripReply
 	(*common.ScripInfo)(nil),              // 12: api.common.ScripInfo
 	(*common.ChatRecordInfo)(nil),         // 13: api.common.ChatRecordInfo
@@ -111,18 +115,20 @@ var file_scrip_proto_depIdxs = []int32{
 	6,  // 7: api.scrip.Scrip.PersonReplyScrip:input_type -> api.common.ReplyScripRequest
 	7,  // 8: api.scrip.Scrip.DeleteScripByPersonID:input_type -> api.common.PersonIDParam
 	8,  // 9: api.scrip.Scrip.ReportScrip:input_type -> api.common.ReportRequest
-	9,  // 10: api.scrip.Scrip.CreateScrip:output_type -> api.common.ScripID
-	10, // 11: api.scrip.Scrip.DeleteScrip:output_type -> google.protobuf.Empty
-	11, // 12: api.scrip.Scrip.FindMyScrip:output_type -> api.common.ScripReply
-	11, // 13: api.scrip.Scrip.FindOtherScrip:output_type -> api.common.ScripReply
-	11, // 14: api.scrip.Scrip.FindRecommendScrip:output_type -> api.common.ScripReply
-	10, // 15: api.scrip.Scrip.PersonLookScrip:output_type -> google.protobuf.Empty
-	12, // 16: api.scrip.Scrip.PersonClickLookBack:output_type -> api.common.ScripInfo
-	13, // 17: api.scrip.Scrip.PersonReplyScrip:output_type -> api.common.ChatRecordInfo
-	10, // 18: api.scrip.Scrip.DeleteScripByPersonID:output_type -> google.protobuf.Empty
-	10, // 19: api.scrip.Scrip.ReportScrip:output_type -> google.protobuf.Empty
-	10, // [10:20] is the sub-list for method output_type
-	0,  // [0:10] is the sub-list for method input_type
+	9,  // 10: api.scrip.Scrip.CronDeleteOldScrip:input_type -> google.protobuf.Empty
+	10, // 11: api.scrip.Scrip.CreateScrip:output_type -> api.common.ScripID
+	9,  // 12: api.scrip.Scrip.DeleteScrip:output_type -> google.protobuf.Empty
+	11, // 13: api.scrip.Scrip.FindMyScrip:output_type -> api.common.ScripReply
+	11, // 14: api.scrip.Scrip.FindOtherScrip:output_type -> api.common.ScripReply
+	11, // 15: api.scrip.Scrip.FindRecommendScrip:output_type -> api.common.ScripReply
+	9,  // 16: api.scrip.Scrip.PersonLookScrip:output_type -> google.protobuf.Empty
+	12, // 17: api.scrip.Scrip.PersonClickLookBack:output_type -> api.common.ScripInfo
+	13, // 18: api.scrip.Scrip.PersonReplyScrip:output_type -> api.common.ChatRecordInfo
+	9,  // 19: api.scrip.Scrip.DeleteScripByPersonID:output_type -> google.protobuf.Empty
+	9,  // 20: api.scrip.Scrip.ReportScrip:output_type -> google.protobuf.Empty
+	9,  // 21: api.scrip.Scrip.CronDeleteOldScrip:output_type -> google.protobuf.Empty
+	11, // [11:22] is the sub-list for method output_type
+	0,  // [0:11] is the sub-list for method input_type
 	0,  // [0:0] is the sub-list for extension type_name
 	0,  // [0:0] is the sub-list for extension extendee
 	0,  // [0:0] is the sub-list for field type_name

+ 2 - 0
api/scrip/scrip.proto

@@ -32,4 +32,6 @@ service Scrip {
   rpc DeleteScripByPersonID (common.PersonIDParam) returns (google.protobuf.Empty){};
   // 举报纸条
   rpc ReportScrip (common.ReportRequest) returns (google.protobuf.Empty){};
+  // 定时删除纸条
+  rpc CronDeleteOldScrip (google.protobuf.Empty) returns (google.protobuf.Empty){};
 }

+ 38 - 0
api/scrip/scrip_grpc.pb.go

@@ -40,6 +40,8 @@ type ScripClient interface {
 	DeleteScripByPersonID(ctx context.Context, in *common.PersonIDParam, opts ...grpc.CallOption) (*emptypb.Empty, error)
 	// 举报纸条
 	ReportScrip(ctx context.Context, in *common.ReportRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
+	// 定时删除纸条
+	CronDeleteOldScrip(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
 }
 
 type scripClient struct {
@@ -140,6 +142,15 @@ func (c *scripClient) ReportScrip(ctx context.Context, in *common.ReportRequest,
 	return out, nil
 }
 
+func (c *scripClient) CronDeleteOldScrip(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) {
+	out := new(emptypb.Empty)
+	err := c.cc.Invoke(ctx, "/api.scrip.Scrip/CronDeleteOldScrip", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // ScripServer is the server API for Scrip service.
 // All implementations must embed UnimplementedScripServer
 // for forward compatibility
@@ -164,6 +175,8 @@ type ScripServer interface {
 	DeleteScripByPersonID(context.Context, *common.PersonIDParam) (*emptypb.Empty, error)
 	// 举报纸条
 	ReportScrip(context.Context, *common.ReportRequest) (*emptypb.Empty, error)
+	// 定时删除纸条
+	CronDeleteOldScrip(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
 	mustEmbedUnimplementedScripServer()
 }
 
@@ -201,6 +214,9 @@ func (UnimplementedScripServer) DeleteScripByPersonID(context.Context, *common.P
 func (UnimplementedScripServer) ReportScrip(context.Context, *common.ReportRequest) (*emptypb.Empty, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method ReportScrip not implemented")
 }
+func (UnimplementedScripServer) CronDeleteOldScrip(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method CronDeleteOldScrip not implemented")
+}
 func (UnimplementedScripServer) mustEmbedUnimplementedScripServer() {}
 
 // UnsafeScripServer may be embedded to opt out of forward compatibility for this service.
@@ -394,6 +410,24 @@ func _Scrip_ReportScrip_Handler(srv interface{}, ctx context.Context, dec func(i
 	return interceptor(ctx, in, info, handler)
 }
 
+func _Scrip_CronDeleteOldScrip_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(emptypb.Empty)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(ScripServer).CronDeleteOldScrip(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/api.scrip.Scrip/CronDeleteOldScrip",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(ScripServer).CronDeleteOldScrip(ctx, req.(*emptypb.Empty))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // Scrip_ServiceDesc is the grpc.ServiceDesc for Scrip service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
@@ -441,6 +475,10 @@ var Scrip_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "ReportScrip",
 			Handler:    _Scrip_ReportScrip_Handler,
 		},
+		{
+			MethodName: "CronDeleteOldScrip",
+			Handler:    _Scrip_CronDeleteOldScrip_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "scrip.proto",