Jianghan 1 год назад
Родитель
Сommit
f6b196e708

+ 75 - 71
api/application.api

@@ -6,7 +6,6 @@ type (
 		Error_msg  string      `json:"error_msg"`
 		Data       interface{} `json:"data"`
 	}
-
 	ClueAddReq {
 		AppId        string  `header:"appId,default=10000"`
 		BaseUserId   int64   `header:"newUserId"`
@@ -15,16 +14,16 @@ type (
 		EntId        int64   `header:"entId,optional"`
 		AccountId    int64   `header:"accountId,optional"`
 		EntDeptId    int64   `header:"entDeptId,optional"`
-		CluesSource  string  `json:"cluesSource"`           //线索来源
-		ClueName     string  `json:"clueName"`              //线索名称
-		Summary      string  `json:"summary"`               //概要信息
+		CluesSource  string  `json:"cluesSource"` //线索来源
+		ClueName     string  `json:"clueName"` //线索名称
+		Summary      string  `json:"summary"` //概要信息
 		FollowUpTime int64   `json:"followUpTime,optional"` //下次跟进时间(时间戳)
-		Types        int64   `json:"types"`                 //处理方式 1自办;2转办
-		User         []int64 `json:"user,optional"`         //企业用户id
+		Types        int64   `json:"types"` //处理方式 1自办;2转办;3待处理
+		User         []int64 `json:"user,optional"` //企业用户id
 		EmployInfoId int64   `json:"employInfoId,optional"` //资讯收录id
-		CreateName   string  `json:"createName"`            //创建人
+		CreateName   string  `json:"createName"` //创建人
+		Channel      string  `json:"channel"` //渠道来源:网页、手动创建
 	}
-
 	SaleChanceReq {
 		AppId             string  `header:"appId,default=10000"`
 		BaseUserId        int64   `header:"newUserId"`
@@ -33,35 +32,33 @@ type (
 		EntId             int64   `header:"entId,optional"`
 		AccountId         int64   `header:"accountId,optional"`
 		EntDeptId         int64   `header:"entDeptId,optional"`
-		ChanceName        string  `json:"chanceName"`                 //机会名称
-		Summary           string  `json:"summary"`                    //概要信息
-		ChanceClassify    int64   `json:"chanceClassify"`             //机会分类
+		ChanceName        string  `json:"chanceName"` //机会名称
+		Summary           string  `json:"summary"` //概要信息
+		ChanceClassify    int64   `json:"chanceClassify"` //机会分类
 		ExpectedOrderTime int64   `json:"expectedOrderTime,optional"` //最初预计落单段时间 时间戳
-		ExpectedMoney     float64 `json:"expectedMoney,optional"`     //最初预计落单金额
-		CustomName        string  `json:"customName"`                 //客户全称
-		BusinessType      int64   `json:"businessType"`               //业务类型  1新客户需求 2老客户需求 3简易项目流程
-		Remarks           string  `json:"remarks,optional"`           //备注
-		NextfollowUpTime  int64   `json:"nextfollowUpTime,optional"`  //下次跟进时间戳
-		Types             int64   `json:"types"`                      //处理方式 1自办;2转办
-		User              []int64 `json:"user,optional"`              //企业用户id
-		EmployInfoId      int64   `json:"employInfoId,optional"`      //资讯收录id
-		CustomId          int64   `json:"customId,optional"`          //客户id
-		CreateName        string  `json:"createName"`                 //创建人
-		ChanceSource      int64   `json:"chanceSource"`               //机会来源
+		ExpectedMoney     float64 `json:"expectedMoney,optional"` //最初预计落单金额
+		CustomName        string  `json:"customName"` //客户全称
+		BusinessType      int64   `json:"businessType"` //业务类型  1新客户需求 2老客户需求 3简易项目流程
+		Remarks           string  `json:"remarks,optional"` //备注
+		NextfollowUpTime  int64   `json:"nextfollowUpTime,optional"` //下次跟进时间戳
+		Types             int64   `json:"types"` //处理方式 1自办;2转办;3待处理
+		User              []int64 `json:"user,optional"` //企业用户id
+		EmployInfoId      int64   `json:"employInfoId,optional"` //资讯收录id
+		CustomId          int64   `json:"customId,optional"` //客户id
+		CreateName        string  `json:"createName"` //创建人
+		ChanceSource      int64   `json:"chanceSource"` //机会来源
 	}
-
 	EmployOperateReq {
 		AppId      string `header:"appId,default=10000"`
 		BaseUserId int64  `header:"newUserId"`
 		PositionId int64  `header:"positionId,optional"`
 		EntUserId  int64  `header:"entUserId,optional"`
 		EntId      int64  `header:"entId,optional"`
-		IdArr      string `json:"idArr"`      //信息id多条信息
-		IsEmploy   bool   `json:"isEmploy"`   //是否收录true收录 false取消收录
+		IdArr      string `json:"idArr"` //信息id多条信息
+		IsEmploy   bool   `json:"isEmploy"` //是否收录true收录 false取消收录
 		EmployType int64  `json:"employType"` //来源方式来源;1招标采购、2企业、3采购单位、4拟在建项目
 		EntDeptId  int64  `header:"entDeptId,optional"`
 	}
-
 	TransferReq {
 		AppId         string   `header:"appId,default=10000"`
 		BaseUserId    int64    `header:"newUserId"`
@@ -71,18 +68,16 @@ type (
 		EmplouIdArr   []string `json:"emplouIdArr"`
 		PositionIdArr []string `json:"positionIdArr"`
 	}
-
 	IgnoreOperateReq {
 		AppId      string `header:"appId,default=10000"`
 		BaseUserId int64  `header:"newUserId"`
 		PositionId int64  `header:"positionId,optional"`
 		EntUserId  int64  `header:"entUserId,optional"`
 		EntId      int64  `header:"entId,optional"`
-		IdArr      string `json:"idArr"`      //id集合
-		IsIgnore   bool   `json:"isIgnore"`   //是否忽略 true 忽略 false取消忽略
+		IdArr      string `json:"idArr"` //id集合
+		IsIgnore   bool   `json:"isIgnore"` //是否忽略 true 忽略 false取消忽略
 		EmployType int64  `json:"employType"` //来源方式来源;1招标采购、2企业、3采购单位、4拟在建项目
 	}
-
 	InfoEmployinfoReq {
 		AppId       string `header:"appId,default=10000"`
 		BaseUserId  int64  `header:"newUserId"`
@@ -90,11 +85,10 @@ type (
 		EntUserId   int64  `header:"entUserId,optional"`
 		EntId       int64  `header:"entId,optional"`
 		EmployType  int64  `json:"employType"` //1标采购、2企业、3采购单位、4拟在建项目
-		IdArr       string `json:"idArr"`      //id
+		IdArr       string `json:"idArr"` //id
 		EntNicheDis int64  `header:"entNicheDis,optional"`
 		EntDeptId   int64  `header:"entDeptId,optional"`
 	}
-
 	CustomAddReq {
 		AppId                string  `header:"appId,default=10000"`
 		BaseUserId           int64   `header:"newUserId"`
@@ -103,27 +97,27 @@ type (
 		EntId                int64   `header:"entId,optional"`
 		AccountId            int64   `header:"accountId,optional"`
 		EntDeptId            int64   `header:"entDeptId,optional"`
-		CustomType           int64   `json:"customType"`                       //客户类型
-		Summary              string  `json:"summary"`                          //概要信息
-		CustomAllName        string  `json:"customAllName"`                    //客户全称
-		CustomAbbreviation   string  `json:"customAbbreviation"`               //客户简称
-		CustomLevel          int64   `json:"customLevel,optional"`             //客户级别
-		CustomIndustry       int64   `json:"customIndustry"`                   //客户行业
-		CustomDetailIndustry int64   `json:"customDetailIndustry"`             //客户细分行业
-		Province             string  `json:"province,optional"`                //省份
-		City                 string  `json:"city,optional"`                    //城市
-		District             string  `json:"district,optional"`                //地区
-		Address              string  `json:"address,optional"`                 //详细地址
-		CompanyPhone         string  `json:"companyPhone,optional"`            //公司电话
-		NextfollowUpTime     int64   `json:"nextfollowUpTime,optional"`        //下次跟进时间戳
-		Types                int64   `json:"types"`                            //处理方式 1自办;2转办
-		User                 []int64 `json:"user,optional"`                    //转办用户
+		CustomType           int64   `json:"customType"` //客户类型
+		Summary              string  `json:"summary"` //概要信息
+		CustomAllName        string  `json:"customAllName"` //客户全称
+		CustomAbbreviation   string  `json:"customAbbreviation"` //客户简称
+		CustomLevel          int64   `json:"customLevel,optional"` //客户级别
+		CustomIndustry       int64   `json:"customIndustry"` //客户行业
+		CustomDetailIndustry int64   `json:"customDetailIndustry"` //客户细分行业
+		Province             string  `json:"province,optional"` //省份
+		City                 string  `json:"city,optional"` //城市
+		District             string  `json:"district,optional"` //地区
+		Address              string  `json:"address,optional"` //详细地址
+		CompanyPhone         string  `json:"companyPhone,optional"` //公司电话
+		NextfollowUpTime     int64   `json:"nextfollowUpTime,optional"` //下次跟进时间戳
+		Types                int64   `json:"types"` //处理方式 1自办;2转办
+		User                 []int64 `json:"user,optional"` //转办用户
 		EmployCustomId       int64   `json:"employCustomId,optional,optional"` //客户收录id
-		EmployInfoId         int64   `json:"employInfoId,optional,optional"`   //资讯收录id
-		Remarks              string  `json:"remarks,optional"`                 //备注
-		CreateName           string  `json:"createName"`                       //创建人
+		EmployInfoId         int64   `json:"employInfoId,optional,optional"` //资讯收录id
+		Remarks              string  `json:"remarks,optional"` //备注
+		CreateName           string  `json:"createName"` //创建人
+		Source               string  `json:"source"` //来源
 	}
-
 	FileUploadReq {
 		AppId      string `header:"appId,default=10000"`
 		BaseUserId int64  `header:"newUserId"`
@@ -131,8 +125,8 @@ type (
 		EntUserId  int64  `header:"entUserId,optional"`
 		EntId      int64  `header:"entId,optional"`
 		BusinessId int64  `form:"businessId"` //业务id
-		Types      int64  `form:"type"`       //类型;1:跟进记录-线下 2:跟进记录-线上 3:跟进记录-备忘 4:销售机会-项目文档 5:客户-客户档案
-		FileType   int64  `form:"fileType"`   //文件类型,产品介绍、项目方案、立项报告、报价文件、招标文件、投标文件、中标通知书、合同、发票、其他文件
+		Types      int64  `form:"type"` //类型;1:跟进记录-线下 2:跟进记录-线上 3:跟进记录-备忘 4:销售机会-项目文档 5:客户-客户档案
+		FileType   int64  `form:"fileType"` //文件类型,产品介绍、项目方案、立项报告、报价文件、招标文件、投标文件、中标通知书、合同、发票、其他文件
 	}
 	EmployDistributeReq {
 		AppId       string             `header:"appId,default=10000"`
@@ -153,21 +147,19 @@ type (
 	EntInfoReq {
 		EntName string `json:"entName"`
 	}
-
 	PushMsgReq {
 		AppId      string  `header:"appId,default=10000"`
 		BaseUserId int64   `header:"newUserId"`
 		PositionId int64   `header:"positionId,optional"`
 		EntUserId  int64   `header:"entUserId,optional"`
 		EntId      int64   `header:"entId,optional"`
-		Title      string  `json:"title"`         //标题
-		Content    string  `json:"content"`       //内容
-		PcHref     string  `json:"pcHref"`        //pc跳转地址
-		MobileHref string  `json:"mobileHref"`    //移动端跳转地址
+		Title      string  `json:"title"` //标题
+		Content    string  `json:"content"` //内容
+		PcHref     string  `json:"pcHref"` //pc跳转地址
+		MobileHref string  `json:"mobileHref"` //移动端跳转地址
 		User       []int64 `json:"user,optional"` //企业用户id
-		MsgType    string  `json:"msgType"`       //消息类型 1-活动优惠 2-服务通知 3-订阅消息 4-项目动态 5-企业动态 6-分析报告 7-系统通知 11-待办
+		MsgType    string  `json:"msgType"` //消息类型 1-活动优惠 2-服务通知 3-订阅消息 4-项目动态 5-企业动态 6-分析报告 7-系统通知 11-待办
 	}
-
 	CanAddReq {
 		AppId          string `header:"appId,default=10000"`
 		BaseUserId     int64  `header:"newUserId"`
@@ -176,12 +168,12 @@ type (
 		EntId          int64  `header:"entId,optional"`
 		AccountId      int64  `header:"accountId,optional"`
 		EntDeptId      int64  `header:"entDeptId,optional"`
-		EmployInfoId   int64  `json:"employInfoId"`            //资讯收录id
+		EmployInfoId   int64  `json:"employInfoId"` //资讯收录id
 		EmployCustomId int64  `json:"employCustomId,optional"` //客户收录id
-		Key            string `json:"key"`                     //创建线索:more_create_clue 创建机会:more_create_chance 创建客户:more_create_custom
-
+		Key            string `json:"key"` //创建线索:more_create_clue 创建机会:more_create_chance 创建客户:more_create_custom
 	}
 )
+
 @server (
 	// 定义一个请求体限制在 100MB 以内的请求,goctl >= 1.5.0 版本支持 (默认1mb)
 	maxBytes: 104857600
@@ -190,37 +182,49 @@ service crmApplication {
 	@doc "添加线索"
 	@handler clueAdd
 	post /crmApplication/clue/add (ClueAddReq) returns (Reply)
+
 	@doc "创建销售机会"
 	@handler saleChanceAdd
 	post /crmApplication/saleChance/add (SaleChanceReq) returns (Reply)
+
 	@doc "收录操作"
 	@handler employOperate
 	post /crmApplication/employ/operate (EmployOperateReq) returns (Reply)
+
 	@doc "商业资讯的转办"
 	@handler transfer
 	post /crmApplication/information/transfer (TransferReq) returns (Reply)
+
 	@doc "忽略操作"
 	@handler ignoreOperate
 	post /crmApplication/ignore/operate (IgnoreOperateReq) returns (Reply)
+
 	@doc "收录情况"
 	@handler employInfo
 	post /crmApplication/employ/info (InfoEmployinfoReq) returns (Reply)
+
 	@doc "创建客户"
 	@handler customAdd
 	post /crmApplication/custom/add (CustomAddReq) returns (Reply)
+
 	@doc "文件上传"
 	@handler fileUpload
-	post /crmApplication/file/upload(FileUploadReq) returns (Reply)
+	post /crmApplication/file/upload (FileUploadReq) returns (Reply)
+
 	@doc "分发"
-	@handler  employDistribute
-	post /crmApplication/employ/distribute(EmployDistributeReq) returns (Reply)
+	@handler employDistribute
+	post /crmApplication/employ/distribute (EmployDistributeReq) returns (Reply)
+
 	@doc "企业详情"
-	@handler   entinfo
-	post /crmApplication/ent/info(EntInfoReq) returns (Reply)
+	@handler entinfo
+	post /crmApplication/ent/info (EntInfoReq) returns (Reply)
+
 	@doc "消息推送"
 	@handler pushMsg
-	post /crmApplication/info/push(PushMsgReq) returns (Reply)
+	post /crmApplication/info/push (PushMsgReq) returns (Reply)
+
 	@doc "是否可以创建"
 	@handler canAddReq
-	post /crmApplication/info/canAdd(CanAddReq) returns (Reply)
-}
+	post /crmApplication/info/canAdd (CanAddReq) returns (Reply)
+}
+

+ 21 - 21
api/internal/handler/routes.go

@@ -19,33 +19,28 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/saleChance/add",
-				Handler: saleChanceAddHandler(serverCtx),
-			},
-			{
-				Method:  http.MethodPost,
-				Path:    "/crmApplication/employ/operate",
-				Handler: employOperateHandler(serverCtx),
+				Path:    "/crmApplication/custom/add",
+				Handler: customAddHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/information/transfer",
-				Handler: transferHandler(serverCtx),
+				Path:    "/crmApplication/employ/distribute",
+				Handler: employDistributeHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/ignore/operate",
-				Handler: ignoreOperateHandler(serverCtx),
+				Path:    "/crmApplication/employ/info",
+				Handler: employInfoHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/employ/info",
-				Handler: employInfoHandler(serverCtx),
+				Path:    "/crmApplication/employ/operate",
+				Handler: employOperateHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/custom/add",
-				Handler: customAddHandler(serverCtx),
+				Path:    "/crmApplication/ent/info",
+				Handler: entinfoHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
@@ -54,13 +49,13 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/employ/distribute",
-				Handler: employDistributeHandler(serverCtx),
+				Path:    "/crmApplication/ignore/operate",
+				Handler: ignoreOperateHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/ent/info",
-				Handler: entinfoHandler(serverCtx),
+				Path:    "/crmApplication/info/canAdd",
+				Handler: canAddReqHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
@@ -69,8 +64,13 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/info/canAdd",
-				Handler: canAddReqHandler(serverCtx),
+				Path:    "/crmApplication/information/transfer",
+				Handler: transferHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/crmApplication/saleChance/add",
+				Handler: saleChanceAddHandler(serverCtx),
 			},
 		},
 		rest.WithMaxBytes(104857600),

+ 1 - 0
api/internal/logic/clueaddlogic.go

@@ -43,6 +43,7 @@ func (l *ClueAddLogic) ClueAdd(req *types.ClueAddReq) (resp *types.Reply, err er
 		CreateName:   req.CreateName,
 		BaseUserId:   req.BaseUserId,
 		EntDeptId:    req.EntDeptId,
+		Channel:      req.Channel,
 	}
 	status, error_msg := service.CanAdd(req.EntId, "more_create_clue", req.EmployInfoId, 0, req.PositionId)
 	if status <= 0 {

+ 1 - 0
api/internal/logic/customaddlogic.go

@@ -54,6 +54,7 @@ func (l *CustomAddLogic) CustomAdd(req *types.CustomAddReq) (resp *types.Reply,
 		EmployInfoId:         req.EmployInfoId,         //资讯收录id
 		Remarks:              req.Remarks,              //备注
 		CreateName:           req.CreateName,           //创建人
+		Source:               req.Source,               //来源
 	}
 
 	status, error_msg := service.CanAdd(req.EntId, "more_create_custom", req.EmployInfoId, req.EmployCustomId, req.PositionId)

+ 101 - 99
api/internal/types/types.go

@@ -1,10 +1,17 @@
 // Code generated by goctl. DO NOT EDIT.
 package types
 
-type Reply struct {
-	Error_code int64       `json:"error_code"`
-	Error_msg  string      `json:"error_msg"`
-	Data       interface{} `json:"data"`
+type CanAddReq struct {
+	AppId          string `header:"appId,default=10000"`
+	BaseUserId     int64  `header:"newUserId"`
+	PositionId     int64  `header:"positionId,optional"`
+	EntUserId      int64  `header:"entUserId,optional"`
+	EntId          int64  `header:"entId,optional"`
+	AccountId      int64  `header:"accountId,optional"`
+	EntDeptId      int64  `header:"entDeptId,optional"`
+	EmployInfoId   int64  `json:"employInfoId"`            //资讯收录id
+	EmployCustomId int64  `json:"employCustomId,optional"` //客户收录id
+	Key            string `json:"key"`                     //创建线索:more_create_clue 创建机会:more_create_chance 创建客户:more_create_custom
 }
 
 type ClueAddReq struct {
@@ -19,80 +26,11 @@ type ClueAddReq struct {
 	ClueName     string  `json:"clueName"`              //线索名称
 	Summary      string  `json:"summary"`               //概要信息
 	FollowUpTime int64   `json:"followUpTime,optional"` //下次跟进时间(时间戳)
-	Types        int64   `json:"types"`                 //处理方式 1自办;2转办
+	Types        int64   `json:"types"`                 //处理方式 1自办;2转办;3待处理
 	User         []int64 `json:"user,optional"`         //企业用户id
 	EmployInfoId int64   `json:"employInfoId,optional"` //资讯收录id
 	CreateName   string  `json:"createName"`            //创建人
-}
-
-type SaleChanceReq struct {
-	AppId             string  `header:"appId,default=10000"`
-	BaseUserId        int64   `header:"newUserId"`
-	PositionId        int64   `header:"positionId,optional"`
-	EntUserId         int64   `header:"entUserId,optional"`
-	EntId             int64   `header:"entId,optional"`
-	AccountId         int64   `header:"accountId,optional"`
-	EntDeptId         int64   `header:"entDeptId,optional"`
-	ChanceName        string  `json:"chanceName"`                 //机会名称
-	Summary           string  `json:"summary"`                    //概要信息
-	ChanceClassify    int64   `json:"chanceClassify"`             //机会分类
-	ExpectedOrderTime int64   `json:"expectedOrderTime,optional"` //最初预计落单段时间 时间戳
-	ExpectedMoney     float64 `json:"expectedMoney,optional"`     //最初预计落单金额
-	CustomName        string  `json:"customName"`                 //客户全称
-	BusinessType      int64   `json:"businessType"`               //业务类型  1新客户需求 2老客户需求 3简易项目流程
-	Remarks           string  `json:"remarks,optional"`           //备注
-	NextfollowUpTime  int64   `json:"nextfollowUpTime,optional"`  //下次跟进时间戳
-	Types             int64   `json:"types"`                      //处理方式 1自办;2转办
-	User              []int64 `json:"user,optional"`              //企业用户id
-	EmployInfoId      int64   `json:"employInfoId,optional"`      //资讯收录id
-	CustomId          int64   `json:"customId,optional"`          //客户id
-	CreateName        string  `json:"createName"`                 //创建人
-	ChanceSource      int64   `json:"chanceSource"`               //机会来源
-}
-
-type EmployOperateReq struct {
-	AppId      string `header:"appId,default=10000"`
-	BaseUserId int64  `header:"newUserId"`
-	PositionId int64  `header:"positionId,optional"`
-	EntUserId  int64  `header:"entUserId,optional"`
-	EntId      int64  `header:"entId,optional"`
-	IdArr      string `json:"idArr"`      //信息id多条信息
-	IsEmploy   bool   `json:"isEmploy"`   //是否收录true收录 false取消收录
-	EmployType int64  `json:"employType"` //来源方式来源;1招标采购、2企业、3采购单位、4拟在建项目
-	EntDeptId  int64  `header:"entDeptId,optional"`
-}
-
-type TransferReq struct {
-	AppId         string   `header:"appId,default=10000"`
-	BaseUserId    int64    `header:"newUserId"`
-	PositionId    int64    `header:"positionId,optional"`
-	EntUserId     int64    `header:"entUserId,optional"`
-	EntId         int64    `header:"entId,optional"`
-	EmplouIdArr   []string `json:"emplouIdArr"`
-	PositionIdArr []string `json:"positionIdArr"`
-}
-
-type IgnoreOperateReq struct {
-	AppId      string `header:"appId,default=10000"`
-	BaseUserId int64  `header:"newUserId"`
-	PositionId int64  `header:"positionId,optional"`
-	EntUserId  int64  `header:"entUserId,optional"`
-	EntId      int64  `header:"entId,optional"`
-	IdArr      string `json:"idArr"`      //id集合
-	IsIgnore   bool   `json:"isIgnore"`   //是否忽略 true 忽略 false取消忽略
-	EmployType int64  `json:"employType"` //来源方式来源;1招标采购、2企业、3采购单位、4拟在建项目
-}
-
-type InfoEmployinfoReq struct {
-	AppId       string `header:"appId,default=10000"`
-	BaseUserId  int64  `header:"newUserId"`
-	PositionId  int64  `header:"positionId,optional"`
-	EntUserId   int64  `header:"entUserId,optional"`
-	EntId       int64  `header:"entId,optional"`
-	EmployType  int64  `json:"employType"` //1标采购、2企业、3采购单位、4拟在建项目
-	IdArr       string `json:"idArr"`      //id
-	EntNicheDis int64  `header:"entNicheDis,optional"`
-	EntDeptId   int64  `header:"entDeptId,optional"`
+	Channel      string  `json:"channel"`               //渠道来源:网页、手动创建
 }
 
 type CustomAddReq struct {
@@ -122,17 +60,13 @@ type CustomAddReq struct {
 	EmployInfoId         int64   `json:"employInfoId,optional,optional"`   //资讯收录id
 	Remarks              string  `json:"remarks,optional"`                 //备注
 	CreateName           string  `json:"createName"`                       //创建人
+	Source               string  `json:"source"`                           //来源
 }
 
-type FileUploadReq struct {
-	AppId      string `header:"appId,default=10000"`
-	BaseUserId int64  `header:"newUserId"`
-	PositionId int64  `header:"positionId,optional"`
-	EntUserId  int64  `header:"entUserId,optional"`
-	EntId      int64  `header:"entId,optional"`
-	BusinessId int64  `form:"businessId"` //业务id
-	Types      int64  `form:"type"`       //类型;1:跟进记录-线下 2:跟进记录-线上 3:跟进记录-备忘 4:销售机会-项目文档 5:客户-客户档案
-	FileType   int64  `form:"fileType"`   //文件类型,产品介绍、项目方案、立项报告、报价文件、招标文件、投标文件、中标通知书、合同、发票、其他文件
+type DistributePerson struct {
+	PositionId int64 `json:"positionId"`
+	EntUserId  int64 `json:"entUserId"`
+	EntDeptId  int64 `json:"entDeptId"`
 }
 
 type EmployDistributeReq struct {
@@ -147,16 +81,56 @@ type EmployDistributeReq struct {
 	EntDeptId   int64              `header:"entDeptId,optional"`
 }
 
-type DistributePerson struct {
-	PositionId int64 `json:"positionId"`
-	EntUserId  int64 `json:"entUserId"`
-	EntDeptId  int64 `json:"entDeptId"`
+type EmployOperateReq struct {
+	AppId      string `header:"appId,default=10000"`
+	BaseUserId int64  `header:"newUserId"`
+	PositionId int64  `header:"positionId,optional"`
+	EntUserId  int64  `header:"entUserId,optional"`
+	EntId      int64  `header:"entId,optional"`
+	IdArr      string `json:"idArr"`      //信息id多条信息
+	IsEmploy   bool   `json:"isEmploy"`   //是否收录true收录 false取消收录
+	EmployType int64  `json:"employType"` //来源方式来源;1招标采购、2企业、3采购单位、4拟在建项目
+	EntDeptId  int64  `header:"entDeptId,optional"`
 }
 
 type EntInfoReq struct {
 	EntName string `json:"entName"`
 }
 
+type FileUploadReq struct {
+	AppId      string `header:"appId,default=10000"`
+	BaseUserId int64  `header:"newUserId"`
+	PositionId int64  `header:"positionId,optional"`
+	EntUserId  int64  `header:"entUserId,optional"`
+	EntId      int64  `header:"entId,optional"`
+	BusinessId int64  `form:"businessId"` //业务id
+	Types      int64  `form:"type"`       //类型;1:跟进记录-线下 2:跟进记录-线上 3:跟进记录-备忘 4:销售机会-项目文档 5:客户-客户档案
+	FileType   int64  `form:"fileType"`   //文件类型,产品介绍、项目方案、立项报告、报价文件、招标文件、投标文件、中标通知书、合同、发票、其他文件
+}
+
+type IgnoreOperateReq struct {
+	AppId      string `header:"appId,default=10000"`
+	BaseUserId int64  `header:"newUserId"`
+	PositionId int64  `header:"positionId,optional"`
+	EntUserId  int64  `header:"entUserId,optional"`
+	EntId      int64  `header:"entId,optional"`
+	IdArr      string `json:"idArr"`      //id集合
+	IsIgnore   bool   `json:"isIgnore"`   //是否忽略 true 忽略 false取消忽略
+	EmployType int64  `json:"employType"` //来源方式来源;1招标采购、2企业、3采购单位、4拟在建项目
+}
+
+type InfoEmployinfoReq struct {
+	AppId       string `header:"appId,default=10000"`
+	BaseUserId  int64  `header:"newUserId"`
+	PositionId  int64  `header:"positionId,optional"`
+	EntUserId   int64  `header:"entUserId,optional"`
+	EntId       int64  `header:"entId,optional"`
+	EmployType  int64  `json:"employType"` //1标采购、2企业、3采购单位、4拟在建项目
+	IdArr       string `json:"idArr"`      //id
+	EntNicheDis int64  `header:"entNicheDis,optional"`
+	EntDeptId   int64  `header:"entDeptId,optional"`
+}
+
 type PushMsgReq struct {
 	AppId      string  `header:"appId,default=10000"`
 	BaseUserId int64   `header:"newUserId"`
@@ -171,15 +145,43 @@ type PushMsgReq struct {
 	MsgType    string  `json:"msgType"`       //消息类型 1-活动优惠 2-服务通知 3-订阅消息 4-项目动态 5-企业动态 6-分析报告 7-系统通知 11-待办
 }
 
-type CanAddReq struct {
-	AppId          string `header:"appId,default=10000"`
-	BaseUserId     int64  `header:"newUserId"`
-	PositionId     int64  `header:"positionId,optional"`
-	EntUserId      int64  `header:"entUserId,optional"`
-	EntId          int64  `header:"entId,optional"`
-	AccountId      int64  `header:"accountId,optional"`
-	EntDeptId      int64  `header:"entDeptId,optional"`
-	EmployInfoId   int64  `json:"employInfoId"`            //资讯收录id
-	EmployCustomId int64  `json:"employCustomId,optional"` //客户收录id
-	Key            string `json:"key"`                     //创建线索:more_create_clue 创建机会:more_create_chance 创建客户:more_create_custom
+type Reply struct {
+	Error_code int64       `json:"error_code"`
+	Error_msg  string      `json:"error_msg"`
+	Data       interface{} `json:"data"`
+}
+
+type SaleChanceReq struct {
+	AppId             string  `header:"appId,default=10000"`
+	BaseUserId        int64   `header:"newUserId"`
+	PositionId        int64   `header:"positionId,optional"`
+	EntUserId         int64   `header:"entUserId,optional"`
+	EntId             int64   `header:"entId,optional"`
+	AccountId         int64   `header:"accountId,optional"`
+	EntDeptId         int64   `header:"entDeptId,optional"`
+	ChanceName        string  `json:"chanceName"`                 //机会名称
+	Summary           string  `json:"summary"`                    //概要信息
+	ChanceClassify    int64   `json:"chanceClassify"`             //机会分类
+	ExpectedOrderTime int64   `json:"expectedOrderTime,optional"` //最初预计落单段时间 时间戳
+	ExpectedMoney     float64 `json:"expectedMoney,optional"`     //最初预计落单金额
+	CustomName        string  `json:"customName"`                 //客户全称
+	BusinessType      int64   `json:"businessType"`               //业务类型  1新客户需求 2老客户需求 3简易项目流程
+	Remarks           string  `json:"remarks,optional"`           //备注
+	NextfollowUpTime  int64   `json:"nextfollowUpTime,optional"`  //下次跟进时间戳
+	Types             int64   `json:"types"`                      //处理方式 1自办;2转办;3待处理
+	User              []int64 `json:"user,optional"`              //企业用户id
+	EmployInfoId      int64   `json:"employInfoId,optional"`      //资讯收录id
+	CustomId          int64   `json:"customId,optional"`          //客户id
+	CreateName        string  `json:"createName"`                 //创建人
+	ChanceSource      int64   `json:"chanceSource"`               //机会来源
+}
+
+type TransferReq struct {
+	AppId         string   `header:"appId,default=10000"`
+	BaseUserId    int64    `header:"newUserId"`
+	PositionId    int64    `header:"positionId,optional"`
+	EntUserId     int64    `header:"entUserId,optional"`
+	EntId         int64    `header:"entId,optional"`
+	EmplouIdArr   []string `json:"emplouIdArr"`
+	PositionIdArr []string `json:"positionIdArr"`
 }

+ 39 - 33
service/custom.go

@@ -17,7 +17,7 @@ import (
 	"github.com/gogf/gf/v2/util/gconv"
 )
 
-//客户相关
+// 客户相关
 type CustomService struct {
 	BaseUserId           int64
 	PositionId           int64
@@ -45,9 +45,10 @@ type CustomService struct {
 	EmployInfoId         int64   //资讯收录id
 	Remarks              string  //备注
 	CreateName           string  //创建人
+	Source               string
 }
 
-//Add 创建客户
+// Add 创建客户
 func (this *CustomService) Add(ctx context.Context) (int64, string) {
 	nowtime := time.Now().Format(date.Date_Full_Layout)
 	nextFollowTime := time.Unix(this.NextfollowUpTime, 0).Format(date.Date_Full_Layout)
@@ -77,19 +78,17 @@ func (this *CustomService) Add(ctx context.Context) (int64, string) {
 			transferArr = append(transferArr, resp.PositionId)
 			baseUserIdArr = append(baseUserIdArr, resp.UserId)
 		}
-
-		//客户3
-		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.EmployInfoId, this.EmployCustomId, this.CustomType, this.CustomAllName, this.CustomAbbreviation, this.Summary, qu.If(this.CustomLevel == 0, nil, this.CustomLevel), this.CustomIndustry, this.CustomDetailIndustry, qu.If(this.Province == "", nil, this.Province), qu.If(this.City == "", nil, this.City), qu.If(this.District == "", nil, this.District), qu.If(this.Address == "", nil, this.Address), qu.If(this.CompanyPhone == "", nil, this.CompanyPhone), qu.If(this.Remarks == "", nil, this.Remarks), this.CreateName, nowtime)
+		//客户
+		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.EmployInfoId, this.EmployCustomId, this.CustomType, this.CustomAllName, this.CustomAbbreviation, this.Summary, qu.If(this.CustomLevel == 0, nil, this.CustomLevel), this.CustomIndustry, this.CustomDetailIndustry, qu.If(this.Province == "", nil, this.Province), qu.If(this.City == "", nil, this.City), qu.If(this.District == "", nil, this.District), qu.If(this.Address == "", nil, this.Address), qu.If(this.CompanyPhone == "", nil, this.CompanyPhone), qu.If(this.Remarks == "", nil, this.Remarks), this.CreateName, nowtime, this.Source)
 		//任务
 		argsTask = append(argsTask, this.EntId, this.CustomAllName+"的跟进任务", 3, this.PositionId, 1, nowtime, 1, 0, qu.If(this.NextfollowUpTime == 0, nil, nextFollowTime), nil, nil)
-
 		customId, taskId = SaveCustom(ctx, args, argsTask, argsTaskTeam, this.EmployInfoId, this.EmployCustomId, this.PositionId, this.CreateName, transferArr, this.EntId, this.EntUserId, this.EntDeptId)
 		if customId < 0 {
 			return -1, groupId
 		}
 	} else if this.Types == 1 {
 		//客户
-		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.EmployInfoId, this.EmployCustomId, this.CustomType, this.CustomAllName, this.CustomAbbreviation, this.Summary, qu.If(this.CustomLevel == 0, nil, this.CustomLevel), this.CustomIndustry, this.CustomDetailIndustry, qu.If(this.Province == "", nil, this.Province), qu.If(this.City == "", nil, this.City), qu.If(this.District == "", nil, this.District), qu.If(this.Address == "", nil, this.Address), qu.If(this.CompanyPhone == "", nil, this.CompanyPhone), qu.If(this.Remarks == "", nil, this.Remarks), this.CreateName, nowtime)
+		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.EmployInfoId, this.EmployCustomId, this.CustomType, this.CustomAllName, this.CustomAbbreviation, this.Summary, qu.If(this.CustomLevel == 0, nil, this.CustomLevel), this.CustomIndustry, this.CustomDetailIndustry, qu.If(this.Province == "", nil, this.Province), qu.If(this.City == "", nil, this.City), qu.If(this.District == "", nil, this.District), qu.If(this.Address == "", nil, this.Address), qu.If(this.CompanyPhone == "", nil, this.CompanyPhone), qu.If(this.Remarks == "", nil, this.Remarks), this.CreateName, nowtime, this.Source)
 		//任务s
 		argsTask = append(argsTask, this.EntId, this.CustomAllName+"的跟进任务", 3, this.PositionId, 2, nowtime, 1, 0, qu.If(this.NextfollowUpTime == 0, nil, nextFollowTime), nil, nil)
 		//任务团队
@@ -111,45 +110,52 @@ func (this *CustomService) Add(ctx context.Context) (int64, string) {
 		// 	AccountId:  this.AccountId,
 		// }
 		// groupId = gp.GroupAdd()
+	} else if this.Types == 3 {
+		//客户
+		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.EmployInfoId, this.EmployCustomId, this.CustomType, this.CustomAllName, this.CustomAbbreviation, this.Summary, qu.If(this.CustomLevel == 0, nil, this.CustomLevel), this.CustomIndustry, this.CustomDetailIndustry, qu.If(this.Province == "", nil, this.Province), qu.If(this.City == "", nil, this.City), qu.If(this.District == "", nil, this.District), qu.If(this.Address == "", nil, this.Address), qu.If(this.CompanyPhone == "", nil, this.CompanyPhone), qu.If(this.Remarks == "", nil, this.Remarks), this.CreateName, nowtime, this.Source)
+		//任务
+		argsTask = append(argsTask, this.EntId, this.CustomAllName+"的跟进任务", 3, this.PositionId, 1, nowtime, 1, 0, qu.If(this.NextfollowUpTime == 0, nil, nextFollowTime), nil, nil)
+		customId, taskId = SaveCustom(ctx, args, argsTask, argsTaskTeam, this.EmployInfoId, this.EmployCustomId, this.PositionId, this.CreateName, []int64{}, this.EntId, this.EntUserId, this.EntDeptId)
+		if customId < 0 {
+			return -1, groupId
+		}
+		baseUserIdArr = append(baseUserIdArr, this.BaseUserId)
 	}
 	u := &User{BaseUserIds: baseUserIdArr}
 
-	var kb strings.Builder
-	var vb strings.Builder
-	for k, v := range u.GetUserId(this.EntId) {
-		kb.WriteString(k + ",")
-		vb.WriteString(gconv.String(v) + ",")
-		userId := strings.TrimRight(kb.String(), ",")
-		positionId := strings.TrimRight(vb.String(), ",")
-
-		next := strings.Replace(time.Unix(this.NextfollowUpTime, 0).Format(YYYYMMDDHHMM), " ", "%20", -1)
-
-		pcHref := ""
-		content := ""
-		if this.Types == 1 {
-			pcHref = fmt.Sprintf(cm.Push.Custom.Create.MyselfPcHref, positionId, taskId, customId)
-			content = fmt.Sprintf(cm.Push.Custom.Create.MySelfContent, this.CreateName, strings.Replace(date.NowFormat(YYYYMMDDHHMM), " ", "%20", -1), next)
-
-		} else if this.Types == 2 {
-			pcHref = fmt.Sprintf(cm.Push.Custom.Create.TransferPcHref, positionId)
-			content = fmt.Sprintf(cm.Push.Custom.Create.TransferContent, this.CreateName, strings.Replace(date.NowFormat(YYYYMMDDHHMM), " ", "%20", -1), next)
+	if this.Types != 3 {
+		var kb strings.Builder
+		var vb strings.Builder
+		for k, v := range u.GetUserId(this.EntId) {
+			kb.WriteString(k + ",")
+			vb.WriteString(gconv.String(v) + ",")
+			userId := strings.TrimRight(kb.String(), ",")
+			positionId := strings.TrimRight(vb.String(), ",")
+			next := strings.Replace(time.Unix(this.NextfollowUpTime, 0).Format(YYYYMMDDHHMM), " ", "%20", -1)
+			pcHref := ""
+			content := ""
+			if this.Types == 1 {
+				pcHref = fmt.Sprintf(cm.Push.Custom.Create.MyselfPcHref, positionId, taskId, customId)
+				content = fmt.Sprintf(cm.Push.Custom.Create.MySelfContent, this.CreateName, strings.Replace(date.NowFormat(YYYYMMDDHHMM), " ", "%20", -1), next)
+			} else if this.Types == 2 {
+				pcHref = fmt.Sprintf(cm.Push.Custom.Create.TransferPcHref, positionId)
+				content = fmt.Sprintf(cm.Push.Custom.Create.TransferContent, this.CreateName, strings.Replace(date.NowFormat(YYYYMMDDHHMM), " ", "%20", -1), next)
+			}
+			StationMailPush(userId, positionId, cm.Push.Custom.Create.Title, content, pcHref, cm.Push.Custom.Create.MobileHref, "2")
 		}
-
-		StationMailPush(userId, positionId, cm.Push.Custom.Create.Title, content, pcHref, cm.Push.Custom.Create.MobileHref, "2")
 	}
 
 	return 1, groupId
 }
 
-//
 func SaleCustomAdd(tx *sql.Tx, args []interface{}) int64 {
-	fields := []string{"position_id", "ent_id", "ent_user_id", "employ_info_id", "employ_custom_id", "type", "full_name", "sort_name", "summary", "level", "industry", "subdivision_industry", "province", "city", "county", "address", "phone", "remark", "create_person", "create_time"}
+	fields := []string{"position_id", "ent_id", "ent_user_id", "employ_info_id", "employ_custom_id", "type", "full_name", "sort_name", "summary", "level", "industry", "subdivision_industry", "province", "city", "county", "address", "phone", "remark", "create_person", "create_time", "source"}
 	_, id := cm.CrmMysql.InsertBatchByTx(tx, entity.CUSTOM, fields, args)
 	return id
 }
 
-//EmployUpdate 是否创建线索/机会/客户修改
-//return employ_info_id,employ_custom_id
+// EmployUpdate 是否创建线索/机会/客户修改
+// return employ_info_id,employ_custom_id
 func EmployUpdate(tx *sql.Tx, employ_info_id, employ_custom_id, positionId int64, key string, entId, entUserId, entDeptId int64) (int64, int64) {
 	tablename := ""
 	id := int64(0)
@@ -248,7 +254,7 @@ func SaveCustom(ctx context.Context, argsCustom, argsTask, argsTaskTeam []interf
 	return customId, taskId
 }
 
-//SaveLedger 操作台帐相关
+// SaveLedger 操作台帐相关
 func SaveLedger(ctx context.Context, positionId, businessId, taskId int64, types, content, createPerson string) bool {
 	//操作台账
 	resp, err := cm.BaseCenterRpc.LedgerAdd(ctx, &baseC.LedgerAddReq{

+ 31 - 21
service/sale_chance.go

@@ -115,34 +115,44 @@ func (this *SaleChanceService) Add(ctx context.Context) (int64, string) {
 		// 	AccountId:  this.AccountId,
 		// }
 		// groupId = gp.GroupAdd()
+	} else if this.Types == 3 {
+		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.EmployInfoId, this.CustomId, this.BusinessType, this.ChanceName, this.Summary, this.ChanceClassify, qu.If(this.ExpectedOrderTime == 0, nil, expect_deal_time), qu.If(this.ExpectedMoney == 0, nil, this.ExpectedMoney), qu.If(this.Remarks == "", nil, this.Remarks), nowtime, this.CreateName, this.ChanceSource)
+		//任务
+		argsTask = append(argsTask, this.EntId, this.ChanceName+"的跟进任务", 2, this.PositionId, 1, nowtime, 1, 0, qu.If(this.NextfollowUpTime == 0, nil, nextFollowTime), this.BusinessType, stageId)
+		chanceId, taskId = SaveChange(ctx, args, argsTask, argsTaskTeam, this.EmployInfoId, this.CustomId, this.PositionId, this.BusinessType, this.CreateName, []int64{}, this.EntId, this.EntUserId, this.EntDeptId)
+		if chanceId < 0 {
+			return -1, groupId
+		}
+		baseUserIdArr = append(baseUserIdArr, this.BaseUserId)
 	}
 
 	u := &User{BaseUserIds: baseUserIdArr}
 
-	var kb strings.Builder
-	var vb strings.Builder
-	for k, v := range u.GetUserId(this.EntId) {
-		kb.WriteString(k + ",")
-		vb.WriteString(gconv.String(v) + ",")
-		userId := strings.TrimRight(kb.String(), ",")
-		positionId := strings.TrimRight(vb.String(), ",")
-
-		next := strings.Replace(time.Unix(this.NextfollowUpTime, 0).Format(YYYYMMDDHHMM), " ", "%20", -1)
-		content := ""
-		pcHref := ""
-		if this.Types == 1 {
-			pcHref = fmt.Sprintf(cm.Push.SaleChance.Create.MyselfPcHref, positionId, taskId, chanceId)
-			content = fmt.Sprintf(cm.Push.SaleChance.Create.MySelfContent, this.CreateName, strings.Replace(date.NowFormat(YYYYMMDDHHMM), " ", "%20", -1), next)
-
-		} else if this.Types == 2 {
-			pcHref = fmt.Sprintf(cm.Push.SaleChance.Create.TransferPcHref, positionId)
-			content = fmt.Sprintf(cm.Push.SaleChance.Create.TransferContent, this.CreateName, strings.Replace(date.NowFormat(YYYYMMDDHHMM), " ", "%20", -1), next)
-		}
+	if this.Types != 3 {
+		var kb strings.Builder
+		var vb strings.Builder
+		for k, v := range u.GetUserId(this.EntId) {
+			kb.WriteString(k + ",")
+			vb.WriteString(gconv.String(v) + ",")
+			userId := strings.TrimRight(kb.String(), ",")
+			positionId := strings.TrimRight(vb.String(), ",")
+
+			next := strings.Replace(time.Unix(this.NextfollowUpTime, 0).Format(YYYYMMDDHHMM), " ", "%20", -1)
+			content := ""
+			pcHref := ""
+			if this.Types == 1 {
+				pcHref = fmt.Sprintf(cm.Push.SaleChance.Create.MyselfPcHref, positionId, taskId, chanceId)
+				content = fmt.Sprintf(cm.Push.SaleChance.Create.MySelfContent, this.CreateName, strings.Replace(date.NowFormat(YYYYMMDDHHMM), " ", "%20", -1), next)
+
+			} else if this.Types == 2 {
+				pcHref = fmt.Sprintf(cm.Push.SaleChance.Create.TransferPcHref, positionId)
+				content = fmt.Sprintf(cm.Push.SaleChance.Create.TransferContent, this.CreateName, strings.Replace(date.NowFormat(YYYYMMDDHHMM), " ", "%20", -1), next)
+			}
 
-		StationMailPush(userId, positionId, cm.Push.SaleChance.Create.Title, content, pcHref, cm.Push.SaleChance.Create.MobileHref, "2")
+			StationMailPush(userId, positionId, cm.Push.SaleChance.Create.Title, content, pcHref, cm.Push.SaleChance.Create.MobileHref, "2")
 
+		}
 	}
-
 	return 1, groupId
 }
 

+ 37 - 25
service/sale_clue.go

@@ -20,7 +20,7 @@ import (
 var Se = encrypt.SimpleEncrypt{Key: "topnet"}
 var YYYYMMDDHHMM = "2006-01-02 15:04" //%20用于转义
 
-//线索相关
+// 线索相关
 type SaleClueService struct {
 	AppId        string
 	PositionId   int64
@@ -37,10 +37,11 @@ type SaleClueService struct {
 	User         []int64
 	FollowUpTime int64
 	CreateName   string
+	Channel      string
 }
 
-//Add 创建线索
-//return 是否成功,群组id
+// Add 创建线索
+// return 是否成功,群组id
 func (this *SaleClueService) Add(ctx context.Context) (int64, string) {
 	nowtime := time.Now().Format(date.Date_Full_Layout)
 	nextFollowTime := time.Unix(this.FollowUpTime, 0).Format(date.Date_Full_Layout)
@@ -70,7 +71,7 @@ func (this *SaleClueService) Add(ctx context.Context) (int64, string) {
 			baseUserIdArr = append(baseUserIdArr, resp.UserId)
 		}
 		//线索
-		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.ClueName, this.CluesSource, this.Summary, this.EmployInfoId, 0, nowtime, this.CreateName)
+		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.ClueName, this.CluesSource, this.Summary, this.EmployInfoId, 0, nowtime, this.CreateName, this.Channel)
 		//任务
 		argsTask = append(argsTask, this.EntId, this.ClueName+"的跟进任务", 1, this.PositionId, 1, nowtime, 1, 0, qu.If(this.FollowUpTime == 0, nil, nextFollowTime), nil, nil)
 		clueId, taskId = Save(ctx, args, argsTask, argsTaskTeam, this.EmployInfoId, 0, this.PositionId, this.CreateName, transferArr, this.EntId, this.EntUserId, this.EntDeptId)
@@ -79,9 +80,8 @@ func (this *SaleClueService) Add(ctx context.Context) (int64, string) {
 		}
 	} else if this.Types == 1 {
 		//线索
-		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.ClueName, this.CluesSource, this.Summary, this.EmployInfoId, 0, time.Now().Format(date.Date_Full_Layout), this.CreateName)
+		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.ClueName, this.CluesSource, this.Summary, this.EmployInfoId, 0, time.Now().Format(date.Date_Full_Layout), this.CreateName, this.Channel)
 		//任务
-
 		argsTask = append(argsTask, this.EntId, this.ClueName+"的跟进任务", 1, this.PositionId, 2, nowtime, 1, 0, qu.If(this.FollowUpTime == 0, nil, nextFollowTime), nil, nil)
 		//任务团队
 		argsTaskTeam = append(argsTaskTeam, this.PositionId, this.EntUserId, this.CreateName, 1, nowtime)
@@ -102,34 +102,46 @@ func (this *SaleClueService) Add(ctx context.Context) (int64, string) {
 		// 	AccountId:  this.AccountId,
 		// }
 		// groupId = gp.GroupAdd()
+	} else if this.Types == 3 {
+		//线索
+		args = append(args, this.PositionId, this.EntId, this.EntUserId, this.ClueName, this.CluesSource, this.Summary, this.EmployInfoId, 0, nowtime, this.CreateName, this.Channel)
+		//任务
+		argsTask = append(argsTask, this.EntId, this.ClueName+"的跟进任务", 1, this.PositionId, 1, nowtime, 1, 0, qu.If(this.FollowUpTime == 0, nil, nextFollowTime), nil, nil)
+		clueId, taskId = Save(ctx, args, argsTask, argsTaskTeam, this.EmployInfoId, 0, this.PositionId, this.CreateName, []int64{}, this.EntId, this.EntUserId, this.EntDeptId)
+		if clueId < 0 {
+			return -1, groupId
+		}
+		baseUserIdArr = append(baseUserIdArr, this.BaseUserId)
 	}
 	u := &User{BaseUserIds: baseUserIdArr}
 
-	var kb strings.Builder
-	var vb strings.Builder
-	for k, v := range u.GetUserId(this.EntId) {
-		kb.WriteString(k + ",")
-		vb.WriteString(gconv.String(v) + ",")
-		userId := strings.TrimRight(kb.String(), ",")
-		positionId := strings.TrimRight(vb.String(), ",")
-		content, pcHref := "", ""
-		next := strings.Replace(time.Unix(this.FollowUpTime, 0).Format(YYYYMMDDHHMM), " ", "%20", -1)
+	if this.Types != 3 {
+		var kb strings.Builder
+		var vb strings.Builder
+		for k, v := range u.GetUserId(this.EntId) {
+			kb.WriteString(k + ",")
+			vb.WriteString(gconv.String(v) + ",")
+			userId := strings.TrimRight(kb.String(), ",")
+			positionId := strings.TrimRight(vb.String(), ",")
+			content, pcHref := "", ""
+			next := strings.Replace(time.Unix(this.FollowUpTime, 0).Format(YYYYMMDDHHMM), " ", "%20", -1)
 
-		if this.Types == 1 {
-			pcHref = fmt.Sprintf(cm.Push.SaleClue.Create.MyselfPcHref, positionId, taskId, clueId)
-			content = fmt.Sprintf(cm.Push.SaleClue.Create.MySelfContent, this.CreateName, strings.Replace(date.NowFormat(YYYYMMDDHHMM), " ", "%20", -1), next)
-		} else if this.Types == 2 {
-			pcHref = fmt.Sprintf(cm.Push.SaleClue.Create.TransferPcHref, positionId)
-			content = fmt.Sprintf(cm.Push.SaleClue.Create.TransferContent, this.CreateName, strings.Replace(date.NowFormat(YYYYMMDDHHMM), " ", "%20", -1), next)
+			if this.Types == 1 {
+				pcHref = fmt.Sprintf(cm.Push.SaleClue.Create.MyselfPcHref, positionId, taskId, clueId)
+				content = fmt.Sprintf(cm.Push.SaleClue.Create.MySelfContent, this.CreateName, strings.Replace(date.NowFormat(YYYYMMDDHHMM), " ", "%20", -1), next)
+			} else if this.Types == 2 {
+				pcHref = fmt.Sprintf(cm.Push.SaleClue.Create.TransferPcHref, positionId)
+				content = fmt.Sprintf(cm.Push.SaleClue.Create.TransferContent, this.CreateName, strings.Replace(date.NowFormat(YYYYMMDDHHMM), " ", "%20", -1), next)
+			}
+			StationMailPush(userId, positionId, cm.Push.SaleClue.Create.Title, content, pcHref, cm.Push.SaleClue.Create.MobileHref, "2")
 		}
-		StationMailPush(userId, positionId, cm.Push.SaleClue.Create.Title, content, pcHref, cm.Push.SaleClue.Create.MobileHref, "2")
 	}
 	return 1, groupId
 }
 
-//SaleClueAdd 线索存储
+// SaleClueAdd 线索存储
 func SaleClueAdd(tx *sql.Tx, args []interface{}) int64 {
-	fields := []string{"position_id", "ent_id", "ent_user_id", "name", "source", "summary", "employ_info_id", "is_close", "create_time", "create_person"}
+	fields := []string{"position_id", "ent_id", "ent_user_id", "name", "source", "summary", "employ_info_id", "is_close", "create_time", "create_person", "channel"}
 	_, id := cm.CrmMysql.InsertBatchByTx(tx, entity.SALE_CLUE, fields, args)
 	return id
 }
@@ -164,7 +176,7 @@ func TaskAdd(tx *sql.Tx, args, taskTeamArgs []interface{}, transferArr []int64,
 	return -1
 }
 
-//Save 存库
+// Save 存库
 func Save(ctx context.Context, argsClue, argsTask, argsTaskTeam []interface{}, employ_info_id, employ_custom_id, positionId int64, createName string, transferArr []int64, entId, entUserId, entDeptId int64) (int64, int64) {
 	clueId, taskId := int64(-1), int64(-1)
 	//存库