Browse Source

完善接口

xuzhiheng 2 years ago
parent
commit
7c8ed72515

+ 2 - 2
rpc/biService.proto

@@ -43,6 +43,7 @@ message AddProjectResp {
 
 message AddProject {
 	int64 status = 1;
+	int64 count = 2;
 }
 
 message GetInfoIdResp {
@@ -65,13 +66,12 @@ message Resp{
 	int64 error_code = 1;
 	string error_msg = 2;
 	int64 status =3;
-	int64 count = 4;
 }
 
 service BiService {
 	rpc myDataAsset (MyDataAssetReq) returns (MyDataAssetResp); //我的数据资产
 	rpc addProject (AddProjectReq) returns (AddProjectResp); //添加项目
 	rpc getInfoId (AddProjectReq) returns (GetInfoIdResp); //获取添加过项目的信息id
-	rpc drawClue (drawClueReq) returns (Resp); //领取线索
+	rpc drawClue (drawClueReq) returns (AddProjectResp); //领取线索
 	rpc Call (CallReq) returns (Resp); //外呼集成
 }

+ 2 - 2
rpc/biservice/biservice.go

@@ -28,7 +28,7 @@ type (
 		MyDataAsset(ctx context.Context, in *MyDataAssetReq, opts ...grpc.CallOption) (*MyDataAssetResp, error)
 		AddProject(ctx context.Context, in *AddProjectReq, opts ...grpc.CallOption) (*AddProjectResp, error)
 		GetInfoId(ctx context.Context, in *AddProjectReq, opts ...grpc.CallOption) (*GetInfoIdResp, error)
-		DrawClue(ctx context.Context, in *DrawClueReq, opts ...grpc.CallOption) (*Resp, error)
+		DrawClue(ctx context.Context, in *DrawClueReq, opts ...grpc.CallOption) (*AddProjectResp, error)
 		Call(ctx context.Context, in *CallReq, opts ...grpc.CallOption) (*Resp, error)
 	}
 
@@ -58,7 +58,7 @@ func (m *defaultBiService) GetInfoId(ctx context.Context, in *AddProjectReq, opt
 	return client.GetInfoId(ctx, in, opts...)
 }
 
-func (m *defaultBiService) DrawClue(ctx context.Context, in *DrawClueReq, opts ...grpc.CallOption) (*Resp, error) {
+func (m *defaultBiService) DrawClue(ctx context.Context, in *DrawClueReq, opts ...grpc.CallOption) (*AddProjectResp, error) {
 	client := pb.NewBiServiceClient(m.cli.Conn())
 	return client.DrawClue(ctx, in, opts...)
 }

+ 1 - 0
rpc/etc/biservice.yaml

@@ -57,6 +57,7 @@ Logx:
   Level: info #info|error|severe
   KeepDays: 100
 AddCountLimit: 500
+DrawCountLimit: 1000
 TopicName: jy_position_sync
 NsqUrl: 192.168.3.240:4161
 #合力亿捷account_token存储

+ 7 - 6
rpc/internal/config/config.go

@@ -30,12 +30,13 @@ type Config struct {
 		Index   string
 		IType   string
 	}
-	Mode          string
-	AddCountLimit int
-	TopicName     string
-	NsqUrl        string
-	RedisAddress  []string
-	Hlyj          struct {
+	Mode           string
+	AddCountLimit  int
+	DrawCountLimit int
+	TopicName      string
+	NsqUrl         string
+	RedisAddress   []string
+	Hlyj           struct {
 		Appid        string
 		Account      string
 		Secret       string

+ 2 - 2
rpc/internal/logic/drawcluelogic.go

@@ -23,8 +23,8 @@ func NewDrawClueLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DrawClue
 	}
 }
 
-func (l *DrawClueLogic) DrawClue(in *pb.DrawClueReq) (*pb.Resp, error) {
+func (l *DrawClueLogic) DrawClue(in *pb.DrawClueReq) (*pb.AddProjectResp, error) {
 	// todo: add your logic here and delete this line
 
-	return service.DrawClue(in), nil
+	return service.DrawClue(in, l.svcCtx.Config.DrawCountLimit), nil
 }

+ 1 - 1
rpc/internal/server/biserviceserver.go

@@ -37,7 +37,7 @@ func (s *BiServiceServer) GetInfoId(ctx context.Context, in *pb.AddProjectReq) (
 	return l.GetInfoId(in)
 }
 
-func (s *BiServiceServer) DrawClue(ctx context.Context, in *pb.DrawClueReq) (*pb.Resp, error) {
+func (s *BiServiceServer) DrawClue(ctx context.Context, in *pb.DrawClueReq) (*pb.AddProjectResp, error) {
 	l := logic.NewDrawClueLogic(ctx, s.svcCtx)
 	return l.DrawClue(in)
 }

+ 38 - 37
rpc/pb/biService.pb.go

@@ -413,6 +413,7 @@ type AddProject struct {
 	unknownFields protoimpl.UnknownFields
 
 	Status int64 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"`
+	Count  int64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"`
 }
 
 func (x *AddProject) Reset() {
@@ -454,6 +455,13 @@ func (x *AddProject) GetStatus() int64 {
 	return 0
 }
 
+func (x *AddProject) GetCount() int64 {
+	if x != nil {
+		return x.Count
+	}
+	return 0
+}
+
 type GetInfoIdResp struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -635,7 +643,6 @@ type Resp struct {
 	ErrorCode int64  `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3" json:"error_code,omitempty"`
 	ErrorMsg  string `protobuf:"bytes,2,opt,name=error_msg,json=errorMsg,proto3" json:"error_msg,omitempty"`
 	Status    int64  `protobuf:"varint,3,opt,name=status,proto3" json:"status,omitempty"`
-	Count     int64  `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"`
 }
 
 func (x *Resp) Reset() {
@@ -691,13 +698,6 @@ func (x *Resp) GetStatus() int64 {
 	return 0
 }
 
-func (x *Resp) GetCount() int64 {
-	if x != nil {
-		return x.Count
-	}
-	return 0
-}
-
 var File_biService_proto protoreflect.FileDescriptor
 
 var file_biService_proto_rawDesc = []byte{
@@ -757,31 +757,31 @@ var file_biService_proto_rawDesc = []byte{
 	0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f,
 	0x72, 0x4d, 0x73, 0x67, 0x12, 0x1f, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01,
 	0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52,
-	0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x24, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a,
+	0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x3a, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a,
 	0x65, 0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20,
-	0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x5f, 0x0a, 0x0d, 0x47,
-	0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x0a,
-	0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
-	0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x65,
-	0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
-	0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61,
-	0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x43, 0x0a, 0x0b,
-	0x64, 0x72, 0x61, 0x77, 0x43, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1e, 0x0a, 0x0a, 0x70,
-	0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
-	0x0a, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63,
+	0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63,
 	0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e,
-	0x74, 0x22, 0x40, 0x0a, 0x07, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x12, 0x1f, 0x0a, 0x0b,
-	0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
-	0x03, 0x52, 0x0a, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a,
-	0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68,
-	0x6f, 0x6e, 0x65, 0x22, 0x70, 0x0a, 0x04, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x0a, 0x65,
-	0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
-	0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x72,
-	0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65,
-	0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
-	0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12,
-	0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05,
-	0x63, 0x6f, 0x75, 0x6e, 0x74, 0x32, 0xd3, 0x01, 0x0a, 0x09, 0x42, 0x69, 0x53, 0x65, 0x72, 0x76,
+	0x74, 0x22, 0x5f, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x49, 0x64, 0x52, 0x65,
+	0x73, 0x70, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65,
+	0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64,
+	0x65, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x12,
+	0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61,
+	0x74, 0x61, 0x22, 0x43, 0x0a, 0x0b, 0x64, 0x72, 0x61, 0x77, 0x43, 0x6c, 0x75, 0x65, 0x52, 0x65,
+	0x71, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18,
+	0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49,
+	0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03,
+	0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x40, 0x0a, 0x07, 0x43, 0x61, 0x6c, 0x6c, 0x52,
+	0x65, 0x71, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69,
+	0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
+	0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x22, 0x5a, 0x0a, 0x04, 0x52, 0x65, 0x73,
+	0x70, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18,
+	0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65,
+	0x12, 0x1b, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20,
+	0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x16, 0x0a,
+	0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73,
+	0x74, 0x61, 0x74, 0x75, 0x73, 0x32, 0xdd, 0x01, 0x0a, 0x09, 0x42, 0x69, 0x53, 0x65, 0x72, 0x76,
 	0x69, 0x63, 0x65, 0x12, 0x30, 0x0a, 0x0b, 0x6d, 0x79, 0x44, 0x61, 0x74, 0x61, 0x41, 0x73, 0x73,
 	0x65, 0x74, 0x12, 0x0f, 0x2e, 0x4d, 0x79, 0x44, 0x61, 0x74, 0x61, 0x41, 0x73, 0x73, 0x65, 0x74,
 	0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x4d, 0x79, 0x44, 0x61, 0x74, 0x61, 0x41, 0x73, 0x73, 0x65,
@@ -791,11 +791,12 @@ var file_biService_proto_rawDesc = []byte{
 	0x52, 0x65, 0x73, 0x70, 0x12, 0x2b, 0x0a, 0x09, 0x67, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x49,
 	0x64, 0x12, 0x0e, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65,
 	0x71, 0x1a, 0x0e, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x49, 0x64, 0x52, 0x65, 0x73,
-	0x70, 0x12, 0x1f, 0x0a, 0x08, 0x64, 0x72, 0x61, 0x77, 0x43, 0x6c, 0x75, 0x65, 0x12, 0x0c, 0x2e,
-	0x64, 0x72, 0x61, 0x77, 0x43, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65,
-	0x73, 0x70, 0x12, 0x17, 0x0a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x08, 0x2e, 0x43, 0x61, 0x6c,
-	0x6c, 0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e,
-	0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x70, 0x12, 0x29, 0x0a, 0x08, 0x64, 0x72, 0x61, 0x77, 0x43, 0x6c, 0x75, 0x65, 0x12, 0x0c, 0x2e,
+	0x64, 0x72, 0x61, 0x77, 0x43, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x41, 0x64,
+	0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x17, 0x0a, 0x04,
+	0x43, 0x61, 0x6c, 0x6c, 0x12, 0x08, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x05,
+	0x2e, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70,
+	0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -834,7 +835,7 @@ var file_biService_proto_depIdxs = []int32{
 	1, // 7: BiService.myDataAsset:output_type -> MyDataAssetResp
 	4, // 8: BiService.addProject:output_type -> AddProjectResp
 	6, // 9: BiService.getInfoId:output_type -> GetInfoIdResp
-	9, // 10: BiService.drawClue:output_type -> Resp
+	4, // 10: BiService.drawClue:output_type -> AddProjectResp
 	9, // 11: BiService.Call:output_type -> Resp
 	7, // [7:12] is the sub-list for method output_type
 	2, // [2:7] is the sub-list for method input_type

+ 5 - 5
rpc/pb/biService_grpc.pb.go

@@ -33,7 +33,7 @@ type BiServiceClient interface {
 	MyDataAsset(ctx context.Context, in *MyDataAssetReq, opts ...grpc.CallOption) (*MyDataAssetResp, error)
 	AddProject(ctx context.Context, in *AddProjectReq, opts ...grpc.CallOption) (*AddProjectResp, error)
 	GetInfoId(ctx context.Context, in *AddProjectReq, opts ...grpc.CallOption) (*GetInfoIdResp, error)
-	DrawClue(ctx context.Context, in *DrawClueReq, opts ...grpc.CallOption) (*Resp, error)
+	DrawClue(ctx context.Context, in *DrawClueReq, opts ...grpc.CallOption) (*AddProjectResp, error)
 	Call(ctx context.Context, in *CallReq, opts ...grpc.CallOption) (*Resp, error)
 }
 
@@ -72,8 +72,8 @@ func (c *biServiceClient) GetInfoId(ctx context.Context, in *AddProjectReq, opts
 	return out, nil
 }
 
-func (c *biServiceClient) DrawClue(ctx context.Context, in *DrawClueReq, opts ...grpc.CallOption) (*Resp, error) {
-	out := new(Resp)
+func (c *biServiceClient) DrawClue(ctx context.Context, in *DrawClueReq, opts ...grpc.CallOption) (*AddProjectResp, error) {
+	out := new(AddProjectResp)
 	err := c.cc.Invoke(ctx, BiService_DrawClue_FullMethodName, in, out, opts...)
 	if err != nil {
 		return nil, err
@@ -97,7 +97,7 @@ type BiServiceServer interface {
 	MyDataAsset(context.Context, *MyDataAssetReq) (*MyDataAssetResp, error)
 	AddProject(context.Context, *AddProjectReq) (*AddProjectResp, error)
 	GetInfoId(context.Context, *AddProjectReq) (*GetInfoIdResp, error)
-	DrawClue(context.Context, *DrawClueReq) (*Resp, error)
+	DrawClue(context.Context, *DrawClueReq) (*AddProjectResp, error)
 	Call(context.Context, *CallReq) (*Resp, error)
 	mustEmbedUnimplementedBiServiceServer()
 }
@@ -115,7 +115,7 @@ func (UnimplementedBiServiceServer) AddProject(context.Context, *AddProjectReq)
 func (UnimplementedBiServiceServer) GetInfoId(context.Context, *AddProjectReq) (*GetInfoIdResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method GetInfoId not implemented")
 }
-func (UnimplementedBiServiceServer) DrawClue(context.Context, *DrawClueReq) (*Resp, error) {
+func (UnimplementedBiServiceServer) DrawClue(context.Context, *DrawClueReq) (*AddProjectResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method DrawClue not implemented")
 }
 func (UnimplementedBiServiceServer) Call(context.Context, *CallReq) (*Resp, error) {

+ 194 - 147
service/clue.go

@@ -11,7 +11,7 @@ import (
 	"bp.jydev.jianyu360.cn/BaseService/biService/rpc/biservice"
 )
 
-func DrawClue(this *biservice.DrawClueReq) *biservice.Resp {
+func DrawClue(this *biservice.DrawClueReq, countLimit int) *biservice.AddProjectResp {
 	count1 := JyBiTidb.Count("dwd_f_crm_open_sea", map[string]interface{}{"level": 1})
 	count2 := JyBiTidb.Count("dwd_f_crm_open_sea", map[string]interface{}{"level": 2})
 	// count3 := JyBiTidb.Count("dwd_f_crm_open_sea", map[string]interface{}{"level": 3})
@@ -38,16 +38,19 @@ func DrawClue(this *biservice.DrawClueReq) *biservice.Resp {
 	}
 	log.Println(count1, count2)
 	log.Println(counts1, counts2, counts3)
-	count := DrawClues(this.PositionId, counts1, counts2, counts3)
-	return &biservice.Resp{
+	count := DrawClues(this.PositionId, counts1, counts2, counts3, int64(countLimit))
+	log.Println("领取数量 ", count)
+	return &biservice.AddProjectResp{
 		ErrorCode: 0,
-		Status:    1,
-		Count:     int64(count),
+		Data: &biservice.AddProject{
+			Status: 1,
+			Count:  int64(count),
+		},
 	}
 }
 
-func DrawClues(positionId, count1, count2, count3 int64) int {
-	data1, data2, data3, count := &[]map[string]interface{}{}, &[]map[string]interface{}{}, &[]map[string]interface{}{}, 0
+func DrawClues(positionId, count1, count2, count3, countLimit int64) int {
+	data1, data2, data3, drawCount := &[]map[string]interface{}{}, &[]map[string]interface{}{}, &[]map[string]interface{}{}, 0
 	if count1 > 0 {
 		data1 = JyBiTidb.Find("dwd_f_crm_open_sea", map[string]interface{}{"level": 1}, "", "", 0, int(count1))
 	}
@@ -60,164 +63,208 @@ func DrawClues(positionId, count1, count2, count3 int64) int {
 	nowTime := time.Now().Format("2006-01-02 15:04:05")
 	seatNumber, name := getSeatNumber(positionId)
 	if data1 != nil && len(*data1) > 0 {
-		count += len(*data1)
 		for _, v := range *data1 {
 			//update postionid and update record
 			clueId := common.Int64All(v["clue_id"])
-			if JyBiMysql.ExecTx("领取线索等", func(tx *sql.Tx) bool {
-				ok1 := JyBiTidb.UpdateByTx(tx, "dwd_f_crm_clue_info", map[string]interface{}{"id": clueId}, map[string]interface{}{"position_id": positionId, "seatNumber": seatNumber})
-				ok2 := JyBiTidb.DeleteByTx(tx, "dwd_f_crm_open_sea", map[string]interface{}{"clue_id": clueId})
-				seaId := JyBiTidb.InsertByTx(tx, "dwd_f_crm_private_sea", map[string]interface{}{
-					"clue_id":      clueId,
-					"seatNumber":   seatNumber,
-					"position_id":  positionId,
-					"comeintime":   nowTime,
-					"comeinsource": 3,
-					"is_task":      1,
-					"task_time":    nowTime,
-					"tasktime":     nowTime,
-					"taskstatus":   0,
-					"tasksource":   "领取公海线索",
-				})
-				recordId := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
-					"clue_id":      clueId,
-					"position_id":  positionId,
-					"change_field": "position_id",
-					"change_type":  "所属人变更",
-					"old_value":    "/",
-					"new_value":    name,
-					"createtime":   nowTime,
-					"BCPCID":       common.GetRandom(32),
-					"operator_id":  positionId,
-				})
-				recordId1 := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
-					"clue_id":     clueId,
-					"position_id": positionId,
-					"change_type": "领取公海线索",
-					"createtime":  nowTime,
-					"BCPCID":      common.GetRandom(32),
-					"operator_id": positionId,
-				})
-				recordId2 := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
-					"clue_id":     clueId,
-					"position_id": positionId,
-					"change_type": "加入任务车",
-					"new_value":   "领取公海线索",
-					"createtime":  nowTime,
-					"BCPCID":      common.GetRandom(32),
-					"operator_id": positionId,
-				})
-				return ok1 && ok2 && seaId > 0 && recordId > 0 && recordId1 > 0 && recordId2 > 0
-			}) {
-				log.Println("领取线索1成功")
-			} else {
-				log.Println("领取线索1失败")
+			if JyBiTidb.Count("dwd_f_crm_private_sea", map[string]interface{}{"position_id": positionId}) < countLimit {
+				if JyBiMysql.ExecTx("领取线索等", func(tx *sql.Tx) bool {
+					ok1 := JyBiTidb.UpdateByTx(tx, "dwd_f_crm_clue_info", map[string]interface{}{"id": clueId}, map[string]interface{}{"position_id": positionId, "seatNumber": seatNumber, "is_assign": 1, "trailstatus": "01", "updatetime": nowTime, "comeintime": nowTime})
+					ok2 := JyBiTidb.DeleteByTx(tx, "dwd_f_crm_open_sea", map[string]interface{}{"clue_id": clueId})
+					seaId := JyBiTidb.InsertByTx(tx, "dwd_f_crm_private_sea", map[string]interface{}{
+						"clue_id":      clueId,
+						"seatNumber":   seatNumber,
+						"position_id":  positionId,
+						"comeintime":   nowTime,
+						"comeinsource": 3,
+						"is_task":      1,
+						"task_time":    nowTime,
+						"tasktime":     nowTime,
+						"taskstatus":   0,
+						"tasksource":   "领取公海线索",
+					})
+					recordId := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
+						"clue_id":      clueId,
+						"position_id":  positionId,
+						"change_field": "position_id",
+						"change_type":  "所属人变更",
+						"old_value":    "/",
+						"new_value":    name,
+						"createtime":   nowTime,
+						"BCPCID":       common.GetRandom(32),
+						"operator_id":  positionId,
+					})
+					recordId1 := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
+						"clue_id":     clueId,
+						"position_id": positionId,
+						"change_type": "领取公海线索",
+						"createtime":  nowTime,
+						"BCPCID":      common.GetRandom(32),
+						"operator_id": positionId,
+					})
+					recordId2 := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
+						"clue_id":     clueId,
+						"position_id": positionId,
+						"change_type": "加入任务车",
+						"new_value":   "领取公海线索",
+						"createtime":  nowTime,
+						"BCPCID":      common.GetRandom(32),
+						"operator_id": positionId,
+					})
+					recordId3 := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
+						"clue_id":      clueId,
+						"position_id":  positionId,
+						"change_field": "trailstatus",
+						"change_type":  "基本信息变更",
+						"new_value":    "新增",
+						"createtime":   nowTime,
+						"BCPCID":       common.GetRandom(32),
+						"operator_id":  positionId,
+					})
+					return ok1 && ok2 && seaId > 0 && recordId > 0 && recordId1 > 0 && recordId2 > 0 && recordId3 > 0
+				}) {
+					drawCount++
+					log.Println("领取线索1成功")
+				} else {
+					log.Println("领取线索1失败")
+				}
 			}
 		}
 	}
 	if data2 != nil && len(*data2) > 0 {
-		count += len(*data2)
 		for _, v := range *data2 {
 			clueId := common.Int64All(v["clue_id"])
-			if JyBiMysql.ExecTx("领取线索等", func(tx *sql.Tx) bool {
-				ok1 := JyBiTidb.UpdateByTx(tx, "dwd_f_crm_clue_info", map[string]interface{}{"id": clueId}, map[string]interface{}{"position_id": positionId, "seatNumber": seatNumber})
-				ok2 := JyBiTidb.DeleteByTx(tx, "dwd_f_crm_open_sea", map[string]interface{}{"clue_id": clueId})
-				seaId := JyBiTidb.InsertByTx(tx, "dwd_f_crm_private_sea", map[string]interface{}{
-					"clue_id":      clueId,
-					"seatNumber":   seatNumber,
-					"position_id":  positionId,
-					"comeintime":   nowTime,
-					"comeinsource": 3,
-					"is_task":      0,
-				})
-				recordId := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
-					"clue_id":      clueId,
-					"position_id":  positionId,
-					"change_field": "position_id",
-					"change_type":  "所属人变更",
-					"old_value":    "/",
-					"new_value":    name,
-					"createtime":   nowTime,
-					"BCPCID":       common.GetRandom(32),
-					"operator_id":  positionId,
-				})
-				recordId1 := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
-					"clue_id":     clueId,
-					"position_id": positionId,
-					"change_type": "领取公海线索",
-					"createtime":  nowTime,
-					"BCPCID":      common.GetRandom(32),
-					"operator_id": positionId,
-				})
-				recordId2 := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
-					"clue_id":     clueId,
-					"position_id": positionId,
-					"change_type": "加入任务车",
-					"new_value":   "领取公海线索",
-					"createtime":  nowTime,
-					"BCPCID":      common.GetRandom(32),
-					"operator_id": positionId,
-				})
-				return ok1 && ok2 && seaId > 0 && recordId > 0 && recordId1 > 0 && recordId2 > 0
-			}) {
-				log.Println("领取线索2成功")
-			} else {
-				log.Println("领取线索2失败")
+			if JyBiTidb.Count("dwd_f_crm_private_sea", map[string]interface{}{"position_id": positionId}) < countLimit {
+				if JyBiMysql.ExecTx("领取线索等", func(tx *sql.Tx) bool {
+					ok1 := JyBiTidb.UpdateByTx(tx, "dwd_f_crm_clue_info", map[string]interface{}{"id": clueId}, map[string]interface{}{"position_id": positionId, "seatNumber": seatNumber, "is_assign": 1, "trailstatus": "01", "updatetime": nowTime, "comeintime": nowTime})
+					ok2 := JyBiTidb.DeleteByTx(tx, "dwd_f_crm_open_sea", map[string]interface{}{"clue_id": clueId})
+					seaId := JyBiTidb.InsertByTx(tx, "dwd_f_crm_private_sea", map[string]interface{}{
+						"clue_id":      clueId,
+						"seatNumber":   seatNumber,
+						"position_id":  positionId,
+						"comeintime":   nowTime,
+						"comeinsource": 3,
+						"is_task":      1,
+						"task_time":    nowTime,
+						"tasktime":     nowTime,
+						"taskstatus":   0,
+						"tasksource":   "领取公海线索",
+					})
+					recordId := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
+						"clue_id":      clueId,
+						"position_id":  positionId,
+						"change_field": "position_id",
+						"change_type":  "所属人变更",
+						"old_value":    "/",
+						"new_value":    name,
+						"createtime":   nowTime,
+						"BCPCID":       common.GetRandom(32),
+						"operator_id":  positionId,
+					})
+					recordId1 := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
+						"clue_id":     clueId,
+						"position_id": positionId,
+						"change_type": "领取公海线索",
+						"createtime":  nowTime,
+						"BCPCID":      common.GetRandom(32),
+						"operator_id": positionId,
+					})
+					recordId2 := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
+						"clue_id":     clueId,
+						"position_id": positionId,
+						"change_type": "加入任务车",
+						"new_value":   "领取公海线索",
+						"createtime":  nowTime,
+						"BCPCID":      common.GetRandom(32),
+						"operator_id": positionId,
+					})
+					recordId3 := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
+						"clue_id":      clueId,
+						"position_id":  positionId,
+						"change_field": "trailstatus",
+						"change_type":  "基本信息变更",
+						"new_value":    "新增",
+						"createtime":   nowTime,
+						"BCPCID":       common.GetRandom(32),
+						"operator_id":  positionId,
+					})
+					return ok1 && ok2 && seaId > 0 && recordId > 0 && recordId1 > 0 && recordId2 > 0 && recordId3 > 0
+				}) {
+					drawCount++
+					log.Println("领取线索2成功")
+				} else {
+					log.Println("领取线索2失败")
+				}
 			}
 		}
 	}
 	if data3 != nil && len(*data3) > 0 {
-		count += len(*data3)
 		for _, v := range *data3 {
 			clueId := common.Int64All(v["clue_id"])
-			if JyBiMysql.ExecTx("领取线索等", func(tx *sql.Tx) bool {
-				ok1 := JyBiTidb.UpdateByTx(tx, "dwd_f_crm_clue_info", map[string]interface{}{"id": clueId}, map[string]interface{}{"position_id": positionId, "seatNumber": seatNumber})
-				ok2 := JyBiTidb.DeleteByTx(tx, "dwd_f_crm_open_sea", map[string]interface{}{"clue_id": clueId})
-				seaId := JyBiTidb.InsertByTx(tx, "dwd_f_crm_private_sea", map[string]interface{}{
-					"clue_id":      clueId,
-					"seatNumber":   seatNumber,
-					"position_id":  positionId,
-					"comeintime":   nowTime,
-					"comeinsource": 3,
-					"is_task":      0,
-				})
-				recordId := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
-					"clue_id":      clueId,
-					"position_id":  positionId,
-					"change_field": "position_id",
-					"change_type":  "所属人变更",
-					"old_value":    "/",
-					"new_value":    name,
-					"createtime":   nowTime,
-					"BCPCID":       common.GetRandom(32),
-					"operator_id":  positionId,
-				})
-				recordId1 := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
-					"clue_id":     clueId,
-					"position_id": positionId,
-					"change_type": "领取公海线索",
-					"createtime":  nowTime,
-					"BCPCID":      common.GetRandom(32),
-					"operator_id": positionId,
-				})
-				recordId2 := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
-					"clue_id":     clueId,
-					"position_id": positionId,
-					"change_type": "加入任务车",
-					"new_value":   "领取公海线索",
-					"createtime":  nowTime,
-					"BCPCID":      common.GetRandom(32),
-					"operator_id": positionId,
-				})
-				return ok1 && ok2 && seaId > 0 && recordId > 0 && recordId1 > 0 && recordId2 > 0
-			}) {
-				log.Println("领取线索3成功")
-			} else {
-				log.Println("领取线索3失败")
+			if JyBiTidb.Count("dwd_f_crm_private_sea", map[string]interface{}{"position_id": positionId}) < countLimit {
+				if JyBiMysql.ExecTx("领取线索等", func(tx *sql.Tx) bool {
+					ok1 := JyBiTidb.UpdateByTx(tx, "dwd_f_crm_clue_info", map[string]interface{}{"id": clueId}, map[string]interface{}{"position_id": positionId, "seatNumber": seatNumber, "is_assign": 1, "trailstatus": "01", "updatetime": nowTime, "comeintime": nowTime})
+					ok2 := JyBiTidb.DeleteByTx(tx, "dwd_f_crm_open_sea", map[string]interface{}{"clue_id": clueId})
+					seaId := JyBiTidb.InsertByTx(tx, "dwd_f_crm_private_sea", map[string]interface{}{
+						"clue_id":      clueId,
+						"seatNumber":   seatNumber,
+						"position_id":  positionId,
+						"comeintime":   nowTime,
+						"comeinsource": 3,
+						"is_task":      1,
+						"task_time":    nowTime,
+						"tasktime":     nowTime,
+						"taskstatus":   0,
+						"tasksource":   "领取公海线索",
+					})
+					recordId := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
+						"clue_id":      clueId,
+						"position_id":  positionId,
+						"change_field": "position_id",
+						"change_type":  "所属人变更",
+						"old_value":    "/",
+						"new_value":    name,
+						"createtime":   nowTime,
+						"BCPCID":       common.GetRandom(32),
+						"operator_id":  positionId,
+					})
+					recordId1 := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
+						"clue_id":     clueId,
+						"position_id": positionId,
+						"change_type": "领取公海线索",
+						"createtime":  nowTime,
+						"BCPCID":      common.GetRandom(32),
+						"operator_id": positionId,
+					})
+					recordId2 := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
+						"clue_id":     clueId,
+						"position_id": positionId,
+						"change_type": "加入任务车",
+						"new_value":   "领取公海线索",
+						"createtime":  nowTime,
+						"BCPCID":      common.GetRandom(32),
+						"operator_id": positionId,
+					})
+					recordId3 := JyBiTidb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
+						"clue_id":      clueId,
+						"position_id":  positionId,
+						"change_field": "trailstatus",
+						"change_type":  "基本信息变更",
+						"new_value":    "新增",
+						"createtime":   nowTime,
+						"BCPCID":       common.GetRandom(32),
+						"operator_id":  positionId,
+					})
+					return ok1 && ok2 && seaId > 0 && recordId > 0 && recordId1 > 0 && recordId2 > 0 && recordId3 > 0
+				}) {
+					drawCount++
+					log.Println("领取线索3成功")
+				} else {
+					log.Println("领取线索3失败")
+				}
 			}
 		}
 	}
-	return count
+	return drawCount
 }
 
 func getSeatNumber(positionId int64) (seatNumber, name string) {