فهرست منبع

定时删除过期的访客记录(先不用)

wfz 2 سال پیش
والد
کامیت
6487f277a7
3فایلهای تغییر یافته به همراه70 افزوده شده و 24 حذف شده
  1. 30 24
      api/statistics/statistics.pb.go
  2. 2 0
      api/statistics/statistics.proto
  3. 38 0
      api/statistics/statistics_grpc.pb.go

+ 30 - 24
api/statistics/statistics.pb.go

@@ -1208,7 +1208,7 @@ var file_statistics_proto_rawDesc = []byte{
 	0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x74, 0x6e, 0x65, 0x72,
 	0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x72, 0x74, 0x6e, 0x65,
 	0x72, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20,
-	0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x44, 0x32, 0xfc, 0x09, 0x0a, 0x0a,
+	0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x44, 0x32, 0xc9, 0x0a, 0x0a, 0x0a,
 	0x53, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x12, 0x43, 0x0a, 0x0a, 0x4c, 0x6f,
 	0x6f, 0x6b, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x12, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73,
 	0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x2e, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e,
@@ -1288,13 +1288,17 @@ var file_statistics_proto_rawDesc = []byte{
 	0x67, 0x6e, 0x55, 0x73, 0x65, 0x72, 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, 0x18,
 	0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x72, 0x73,
-	0x6f, 0x6e, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x00, 0x42, 0x4f, 0x0a, 0x0e, 0x61, 0x70,
-	0x69, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x50, 0x01, 0x5a, 0x3b,
-	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, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73,
-	0x3b, 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f,
-	0x74, 0x6f, 0x33,
+	0x6f, 0x6e, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x17, 0x43, 0x72,
+	0x6f, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4f, 0x6c, 0x64, 0x4c, 0x6f, 0x6f, 0x6b, 0x52,
+	0x65, 0x63, 0x6f, 0x72, 0x64, 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, 0x4f, 0x0a, 0x0e, 0x61, 0x70, 0x69, 0x2e, 0x73,
+	0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x50, 0x01, 0x5a, 0x3b, 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, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x3b, 0x73, 0x74,
+	0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -1348,22 +1352,24 @@ var file_statistics_proto_depIdxs = []int32{
 	1,  // 12: api.statistics.Statistics.StatisticsSubscribeMessage:input_type -> api.statistics.StatisticsSubscribeMessageRequest
 	0,  // 13: api.statistics.Statistics.ReduceSubscribeMessage:input_type -> api.statistics.ReduceSubscribeMessageRequest
 	17, // 14: api.statistics.Statistics.GetSignUser:input_type -> google.protobuf.Empty
-	17, // 15: api.statistics.Statistics.LookPerson:output_type -> google.protobuf.Empty
-	17, // 16: api.statistics.Statistics.LikePerson:output_type -> google.protobuf.Empty
-	17, // 17: api.statistics.Statistics.UnLikePerson:output_type -> google.protobuf.Empty
-	11, // 18: api.statistics.Statistics.GetLookAndLikeStatisticsMessage:output_type -> api.statistics.LookAndLikeMessageReply
-	12, // 19: api.statistics.Statistics.GetLookStatisticsMessage:output_type -> api.statistics.LookMessageReply
-	17, // 20: api.statistics.Statistics.ReduceLikeUnreadNum:output_type -> google.protobuf.Empty
-	17, // 21: api.statistics.Statistics.UnlockLookRecord:output_type -> google.protobuf.Empty
-	8,  // 22: api.statistics.Statistics.FindLookList:output_type -> api.statistics.LookAndLikeListReply
-	8,  // 23: api.statistics.Statistics.FindLikeList:output_type -> api.statistics.LookAndLikeListReply
-	8,  // 24: api.statistics.Statistics.FindLikedList:output_type -> api.statistics.LookAndLikeListReply
-	18, // 25: api.statistics.Statistics.GetIsLike:output_type -> api.common.IsLike
-	17, // 26: api.statistics.Statistics.StatisticsSubscribeMessage:output_type -> google.protobuf.Empty
-	17, // 27: api.statistics.Statistics.ReduceSubscribeMessage:output_type -> google.protobuf.Empty
-	19, // 28: api.statistics.Statistics.GetSignUser:output_type -> api.common.PersonIDList
-	15, // [15:29] is the sub-list for method output_type
-	1,  // [1:15] is the sub-list for method input_type
+	17, // 15: api.statistics.Statistics.CronDeleteOldLookRecord:input_type -> google.protobuf.Empty
+	17, // 16: api.statistics.Statistics.LookPerson:output_type -> google.protobuf.Empty
+	17, // 17: api.statistics.Statistics.LikePerson:output_type -> google.protobuf.Empty
+	17, // 18: api.statistics.Statistics.UnLikePerson:output_type -> google.protobuf.Empty
+	11, // 19: api.statistics.Statistics.GetLookAndLikeStatisticsMessage:output_type -> api.statistics.LookAndLikeMessageReply
+	12, // 20: api.statistics.Statistics.GetLookStatisticsMessage:output_type -> api.statistics.LookMessageReply
+	17, // 21: api.statistics.Statistics.ReduceLikeUnreadNum:output_type -> google.protobuf.Empty
+	17, // 22: api.statistics.Statistics.UnlockLookRecord:output_type -> google.protobuf.Empty
+	8,  // 23: api.statistics.Statistics.FindLookList:output_type -> api.statistics.LookAndLikeListReply
+	8,  // 24: api.statistics.Statistics.FindLikeList:output_type -> api.statistics.LookAndLikeListReply
+	8,  // 25: api.statistics.Statistics.FindLikedList:output_type -> api.statistics.LookAndLikeListReply
+	18, // 26: api.statistics.Statistics.GetIsLike:output_type -> api.common.IsLike
+	17, // 27: api.statistics.Statistics.StatisticsSubscribeMessage:output_type -> google.protobuf.Empty
+	17, // 28: api.statistics.Statistics.ReduceSubscribeMessage:output_type -> google.protobuf.Empty
+	19, // 29: api.statistics.Statistics.GetSignUser:output_type -> api.common.PersonIDList
+	17, // 30: api.statistics.Statistics.CronDeleteOldLookRecord:output_type -> google.protobuf.Empty
+	16, // [16:31] is the sub-list for method output_type
+	1,  // [1:16] is the sub-list for method input_type
 	1,  // [1:1] is the sub-list for extension type_name
 	1,  // [1:1] is the sub-list for extension extendee
 	0,  // [0:1] is the sub-list for field type_name

+ 2 - 0
api/statistics/statistics.proto

@@ -45,6 +45,8 @@ service Statistics {
   rpc ReduceSubscribeMessage (ReduceSubscribeMessageRequest) returns (google.protobuf.Empty){};
   // 获取订阅了签到的人
   rpc GetSignUser (google.protobuf.Empty) returns (common.PersonIDList){};
+  // 定时删除过期的访客记录
+  rpc CronDeleteOldLookRecord (google.protobuf.Empty) returns (google.protobuf.Empty){};
 }
 
 message ReduceSubscribeMessageRequest{

+ 38 - 0
api/statistics/statistics_grpc.pb.go

@@ -48,6 +48,8 @@ type StatisticsClient interface {
 	ReduceSubscribeMessage(ctx context.Context, in *ReduceSubscribeMessageRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
 	// 获取订阅了签到的人
 	GetSignUser(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*common.PersonIDList, error)
+	// 定时删除过期的访客记录
+	CronDeleteOldLookRecord(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
 }
 
 type statisticsClient struct {
@@ -184,6 +186,15 @@ func (c *statisticsClient) GetSignUser(ctx context.Context, in *emptypb.Empty, o
 	return out, nil
 }
 
+func (c *statisticsClient) CronDeleteOldLookRecord(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) {
+	out := new(emptypb.Empty)
+	err := c.cc.Invoke(ctx, "/api.statistics.Statistics/CronDeleteOldLookRecord", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // StatisticsServer is the server API for Statistics service.
 // All implementations must embed UnimplementedStatisticsServer
 // for forward compatibility
@@ -216,6 +227,8 @@ type StatisticsServer interface {
 	ReduceSubscribeMessage(context.Context, *ReduceSubscribeMessageRequest) (*emptypb.Empty, error)
 	// 获取订阅了签到的人
 	GetSignUser(context.Context, *emptypb.Empty) (*common.PersonIDList, error)
+	// 定时删除过期的访客记录
+	CronDeleteOldLookRecord(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
 	mustEmbedUnimplementedStatisticsServer()
 }
 
@@ -265,6 +278,9 @@ func (UnimplementedStatisticsServer) ReduceSubscribeMessage(context.Context, *Re
 func (UnimplementedStatisticsServer) GetSignUser(context.Context, *emptypb.Empty) (*common.PersonIDList, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method GetSignUser not implemented")
 }
+func (UnimplementedStatisticsServer) CronDeleteOldLookRecord(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method CronDeleteOldLookRecord not implemented")
+}
 func (UnimplementedStatisticsServer) mustEmbedUnimplementedStatisticsServer() {}
 
 // UnsafeStatisticsServer may be embedded to opt out of forward compatibility for this service.
@@ -530,6 +546,24 @@ func _Statistics_GetSignUser_Handler(srv interface{}, ctx context.Context, dec f
 	return interceptor(ctx, in, info, handler)
 }
 
+func _Statistics_CronDeleteOldLookRecord_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.(StatisticsServer).CronDeleteOldLookRecord(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/api.statistics.Statistics/CronDeleteOldLookRecord",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(StatisticsServer).CronDeleteOldLookRecord(ctx, req.(*emptypb.Empty))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // Statistics_ServiceDesc is the grpc.ServiceDesc for Statistics service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
@@ -593,6 +627,10 @@ var Statistics_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "GetSignUser",
 			Handler:    _Statistics_GetSignUser_Handler,
 		},
+		{
+			MethodName: "CronDeleteOldLookRecord",
+			Handler:    _Statistics_CronDeleteOldLookRecord_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "statistics.proto",