|
@@ -115,7 +115,7 @@ func kcJob(data map[string]interface{}) int {
|
|
"label": common.If(position_id > 0, 1, nil),
|
|
"label": common.If(position_id > 0, 1, nil),
|
|
})
|
|
})
|
|
if clueId > 0 {
|
|
if clueId > 0 {
|
|
- AddChangeRecord(nil, clueId, gconv.Int64(common.If(position_id > 0, position_id, -1)), "", "创建线索", "系统自动创建", "", nowTime, -1)
|
|
|
|
|
|
+ AddChangeRecord(nil, clueId, gconv.Int64(common.If(position_id > 0, position_id, -1)), "", "创建线索", "系统自动创建", "", nowTime, "", -1)
|
|
clueData = TiDb.FindOne("dwd_f_crm_clue_info", map[string]interface{}{"uid": uId}, "", "")
|
|
clueData = TiDb.FindOne("dwd_f_crm_clue_info", map[string]interface{}{"uid": uId}, "", "")
|
|
if clueData == nil || len(*clueData) == 0 {
|
|
if clueData == nil || len(*clueData) == 0 {
|
|
return 0
|
|
return 0
|
|
@@ -226,10 +226,10 @@ func kcJob(data map[string]interface{}) int {
|
|
updateMap["is_task"] = 1
|
|
updateMap["is_task"] = 1
|
|
}
|
|
}
|
|
TiDb.Update("dwd_f_csm_customer_info", map[string]interface{}{"clue_id": clueId}, updateMap)
|
|
TiDb.Update("dwd_f_csm_customer_info", map[string]interface{}{"clue_id": clueId}, updateMap)
|
|
- AddChangeRecord(nil, clueId, customerPositionId, "", "成交客户移交", "移交至客户成功组", "", nowTime, -1)
|
|
|
|
|
|
+ AddChangeRecord(nil, clueId, customerPositionId, "", "成交客户移交", "移交至客户成功组", "", nowTime, "", -1)
|
|
if customerPositionId > 0 && (is_transfer == 1 || customerPositionId != gconv.Int64((*csmdata)["position_id"])) {
|
|
if customerPositionId > 0 && (is_transfer == 1 || customerPositionId != gconv.Int64((*csmdata)["position_id"])) {
|
|
- AddChangeRecord(nil, clueId, customerPositionId, "position_id", "客户成功经理", customerName, gconv.String(common.If(oldName != customerName, oldName, common.If(oldName == "", "/", oldName))), nowTime, -1)
|
|
|
|
- AddChangeRecord(nil, clueId, customerPositionId, "", "加入任务车", "未建联", "", nowTime, -1)
|
|
|
|
|
|
+ AddChangeRecord(nil, clueId, customerPositionId, "position_id", "客户成功经理", customerName, gconv.String(common.If(oldName != customerName, oldName, common.If(oldName == "", "/", oldName))), nowTime, "", -1)
|
|
|
|
+ AddChangeRecord(nil, clueId, customerPositionId, "", "加入任务车", "未建联", "", nowTime, "", -1)
|
|
}
|
|
}
|
|
if is_transfer == 1 || customerPositionId != gconv.Int64((*csmdata)["position_id"]) {
|
|
if is_transfer == 1 || customerPositionId != gconv.Int64((*csmdata)["position_id"]) {
|
|
if customerName == db.KeCheng.Admin {
|
|
if customerName == db.KeCheng.Admin {
|
|
@@ -252,11 +252,11 @@ func kcJob(data map[string]interface{}) int {
|
|
cId = TiDb.InsertByTx(tx, "dwd_f_csm_customer_info", saveMap)
|
|
cId = TiDb.InsertByTx(tx, "dwd_f_csm_customer_info", saveMap)
|
|
ok = TiDb.UpdateByTx(tx, "dwd_f_crm_clue_info", map[string]interface{}{"id": clueId}, map[string]interface{}{"is_transfer": 1, "updatetime": nowTime, "name": userName})
|
|
ok = TiDb.UpdateByTx(tx, "dwd_f_crm_clue_info", map[string]interface{}{"id": clueId}, map[string]interface{}{"is_transfer": 1, "updatetime": nowTime, "name": userName})
|
|
if customerPositionId > 0 {
|
|
if customerPositionId > 0 {
|
|
- updateId1 = AddChangeRecord(tx, clueId, customerPositionId, "", "加入任务车", "未建联", "", nowTime, -1)
|
|
|
|
- updateId3 = AddChangeRecord(tx, clueId, customerPositionId, "position_id", "客户成功经理", "/", customerName, nowTime, -1)
|
|
|
|
|
|
+ updateId1 = AddChangeRecord(tx, clueId, customerPositionId, "", "加入任务车", "未建联", "", nowTime, "", -1)
|
|
|
|
+ updateId3 = AddChangeRecord(tx, clueId, customerPositionId, "position_id", "客户成功经理", "/", customerName, nowTime, "", -1)
|
|
}
|
|
}
|
|
KcSend(orderCode, customerName)
|
|
KcSend(orderCode, customerName)
|
|
- updateId2 := AddChangeRecord(tx, clueId, customerPositionId, "", "成交客户移交", "移交至客户成功组", "", nowTime, -1)
|
|
|
|
|
|
+ updateId2 := AddChangeRecord(tx, clueId, customerPositionId, "", "成交客户移交", "移交至客户成功组", "", nowTime, "", -1)
|
|
return cId > -1 && ok && updateId1 > -1 && updateId2 > -1 && updateId3 > -1
|
|
return cId > -1 && ok && updateId1 > -1 && updateId2 > -1 && updateId3 > -1
|
|
}) {
|
|
}) {
|
|
//TiDb.UpdateOrDeleteBySql(`update dwd_f_csm_customer_autodraw_record set count = count + 1 where name = ?`, name)
|
|
//TiDb.UpdateOrDeleteBySql(`update dwd_f_csm_customer_autodraw_record set count = count + 1 where name = ?`, name)
|
|
@@ -412,11 +412,11 @@ func kcAuto() {
|
|
taskstatus := common.IntAll(v["taskstatus"])
|
|
taskstatus := common.IntAll(v["taskstatus"])
|
|
if relationship_building_way != 1 && inventory_way == 1 {
|
|
if relationship_building_way != 1 && inventory_way == 1 {
|
|
tasksources = "2"
|
|
tasksources = "2"
|
|
- AddChangeRecord(nil, clueId, positionId, "", "加入任务车", "未盘点", "", "", -1)
|
|
|
|
|
|
+ AddChangeRecord(nil, clueId, positionId, "", "加入任务车", "未盘点", "", "", "", -1)
|
|
|
|
|
|
} else if inventory_way != 1 && training_way == 1 {
|
|
} else if inventory_way != 1 && training_way == 1 {
|
|
tasksources = "3"
|
|
tasksources = "3"
|
|
- AddChangeRecord(nil, clueId, positionId, "position_id", "加入任务车", "未培训", "", nowTime, -1)
|
|
|
|
|
|
+ AddChangeRecord(nil, clueId, positionId, "position_id", "加入任务车", "未培训", "", nowTime, "", -1)
|
|
}
|
|
}
|
|
if taskstatus == 1 {
|
|
if taskstatus == 1 {
|
|
tasksource = tasksources
|
|
tasksource = tasksources
|
|
@@ -573,10 +573,10 @@ func ordersClue() {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
if clueId > 0 {
|
|
if clueId > 0 {
|
|
- AddChangeRecord(tx, clueId, gconv.Int64(common.If(positionId > 0, positionId, -1)), "", "创建线索", "系统自动创建", "", nowTime, -1)
|
|
|
|
|
|
+ AddChangeRecord(nil, clueId, gconv.Int64(common.If(positionId > 0, positionId, -1)), "", "创建线索", "系统自动创建", "", nowTime, "", -1)
|
|
if is_assign == -3 {
|
|
if is_assign == -3 {
|
|
//新增冻结记录
|
|
//新增冻结记录
|
|
- AddChangeRecord(tx, clueId, positionId, "", "线索冻结", "销售人员私海已达上限", "", nowTime, -1)
|
|
|
|
|
|
+ AddChangeRecord(nil, clueId, positionId, "", "线索冻结", "销售人员私海已达上限", "", nowTime, "", -1)
|
|
|
|
|
|
//移交失败发送消息
|
|
//移交失败发送消息
|
|
if IsFreeze(source, pay_money, gconv.String(positionId), trailstatus) {
|
|
if IsFreeze(source, pay_money, gconv.String(positionId), trailstatus) {
|
|
@@ -666,10 +666,10 @@ func refundAuto() {
|
|
if isAllRefund {
|
|
if isAllRefund {
|
|
//全退款了
|
|
//全退款了
|
|
TiDb.UpdateOrDeleteBySql(`UPDATE dwd_f_crm_clue_info SET is_unfollow=0,is_assign=0,trailstatus="01",position_id=null,seatNumber=null,updatetime=?,comeintime_open=?,comeinsource_open=1,level_open=3,next_trail_time=null,is_task=null,tasktime=null,taskstatus=null,comeinsource_private=null,tasksource=null,is_transfer=0 WHERE id = ?`, nowTime, nowTime, clueId)
|
|
TiDb.UpdateOrDeleteBySql(`UPDATE dwd_f_crm_clue_info SET is_unfollow=0,is_assign=0,trailstatus="01",position_id=null,seatNumber=null,updatetime=?,comeintime_open=?,comeinsource_open=1,level_open=3,next_trail_time=null,is_task=null,tasktime=null,taskstatus=null,comeinsource_private=null,tasksource=null,is_transfer=0 WHERE id = ?`, nowTime, nowTime, clueId)
|
|
- AddChangeRecord(nil, clueId, gconv.Int64(common.If(kcposition_id > 0, kcposition_id, -1)), "", "退回公海", "成交客户申请退款", "", nowTime, -1)
|
|
|
|
- AddChangeRecord(nil, clueId, gconv.Int64(common.If(kcposition_id > 0, kcposition_id, -1)), "trailstatus", "基本信息变更", "商机线索", "成交客户", nowTime, -1)
|
|
|
|
- AddChangeRecord(nil, clueId, gconv.Int64(common.If(kcposition_id > 0, kcposition_id, -1)), "position_id", "客户成功经理", "/", name, nowTime, -1)
|
|
|
|
- AddChangeRecord(nil, clueId, gconv.Int64(common.If(kcposition_id > 0, kcposition_id, -1)), "", "移交销售", "成交客户申请退款", "", nowTime, -1)
|
|
|
|
|
|
+ AddChangeRecord(nil, clueId, gconv.Int64(common.If(kcposition_id > 0, kcposition_id, -1)), "", "退回公海", "成交客户申请退款", "", nowTime, "", -1)
|
|
|
|
+ AddChangeRecord(nil, clueId, gconv.Int64(common.If(kcposition_id > 0, kcposition_id, -1)), "trailstatus", "基本信息变更", "商机线索", "成交客户", nowTime, "", -1)
|
|
|
|
+ AddChangeRecord(nil, clueId, gconv.Int64(common.If(kcposition_id > 0, kcposition_id, -1)), "position_id", "客户成功经理", "/", name, nowTime, "", -1)
|
|
|
|
+ AddChangeRecord(nil, clueId, gconv.Int64(common.If(kcposition_id > 0, kcposition_id, -1)), "", "移交销售", "成交客户申请退款", "", nowTime, "", -1)
|
|
mailData[name] = append(mailData[name], map[string]interface{}{
|
|
mailData[name] = append(mailData[name], map[string]interface{}{
|
|
"company_name": company_name,
|
|
"company_name": company_name,
|
|
"phone": phone,
|
|
"phone": phone,
|
|
@@ -803,14 +803,14 @@ func refundAuto() {
|
|
"cluename": cluename,
|
|
"cluename": cluename,
|
|
})
|
|
})
|
|
}
|
|
}
|
|
- AddChangeRecord(nil, clueId, gconv.Int64(common.If(kcposition_id > 0, kcposition_id, -1)), "trailstatus", "基本信息变更", "商机线索", "", nowTime, -1)
|
|
|
|
- AddChangeRecord(nil, clueId, saleId, "trailstatus", "加入任务车", "线索自动分配-其他-成交客户续约失败", "", nowTime, -1)
|
|
|
|
- AddChangeRecord(nil, clueId, gconv.Int64(common.If(kcposition_id > 0, kcposition_id, -1)), "position_id", "客户成功经理", "/", name, nowTime, -1)
|
|
|
|
- AddChangeRecord(nil, clueId, saleId, "", "移交销售", "成交客户续费失败,到期自动移交", "", nowTime, -1)
|
|
|
|
|
|
+ AddChangeRecord(nil, clueId, gconv.Int64(common.If(kcposition_id > 0, kcposition_id, -1)), "trailstatus", "基本信息变更", "商机线索", "", nowTime, "", -1)
|
|
|
|
+ AddChangeRecord(nil, clueId, saleId, "trailstatus", "加入任务车", "线索自动分配-其他-成交客户续约失败", "", nowTime, "", -1)
|
|
|
|
+ AddChangeRecord(nil, clueId, gconv.Int64(common.If(kcposition_id > 0, kcposition_id, -1)), "position_id", "客户成功经理", "/", name, nowTime, "", -1)
|
|
|
|
+ AddChangeRecord(nil, clueId, saleId, "", "移交销售", "成交客户续费失败,到期自动移交", "", nowTime, "", -1)
|
|
TiDb.UpdateOrDeleteBySql(`UPDATE dwd_f_csm_customer_info SET is_transfer=1 WHERE clue_id = ?`, clueId)
|
|
TiDb.UpdateOrDeleteBySql(`UPDATE dwd_f_csm_customer_info SET is_transfer=1 WHERE clue_id = ?`, clueId)
|
|
if isFull {
|
|
if isFull {
|
|
//新增冻结记录
|
|
//新增冻结记录
|
|
- AddChangeRecord(nil, clueId, 线索冻结, "trailstatus", "线索冻结", "销售人员私海已达上限", "", nowTime, -1)
|
|
|
|
|
|
+ AddChangeRecord(nil, clueId, saleId, "trailstatus", "线索冻结", "销售人员私海已达上限", "", nowTime, "", -1)
|
|
//发送邮件
|
|
//发送邮件
|
|
mailContent := ""
|
|
mailContent := ""
|
|
if cluename != "" {
|
|
if cluename != "" {
|
|
@@ -1310,11 +1310,11 @@ func kcClue(userId, uId, seatNumber, cluename, top_cluetype, sub_cluetype,
|
|
"labelChangeTime": time.Now().Format("2006-01-02"),
|
|
"labelChangeTime": time.Now().Format("2006-01-02"),
|
|
})
|
|
})
|
|
|
|
|
|
- uodateId1 = AddChangeRecord(tx, clueId, positionId, "", "创建线索", "系统自动创建", "", nowTime, -1)
|
|
|
|
- uodateId2 = AddChangeRecord(tx, clueId, positionId, "position_id", "所属人变更", saleName, "/", nowTime, -1)
|
|
|
|
- uodateId3 = AddChangeRecord(tx, clueId, positionId, "trailstatus", "基本信息变更", "新增", "商机线索", nowTime, -1)
|
|
|
|
- uodateId4 = AddChangeRecord(tx, clueId, positionId, "top_cluetype", "基本信息变更", topname, "/", nowTime, -1)
|
|
|
|
- uodateId5 = AddChangeRecord(tx, clueId, positionId, "sub_cluetype", "基本信息变更", subname, "/", nowTime, -1)
|
|
|
|
|
|
+ uodateId1 = AddChangeRecord(tx, clueId, positionId, "", "创建线索", "系统自动创建", "", nowTime, "", -1)
|
|
|
|
+ uodateId2 = AddChangeRecord(tx, clueId, positionId, "position_id", "所属人变更", saleName, "/", nowTime, "", -1)
|
|
|
|
+ uodateId3 = AddChangeRecord(tx, clueId, positionId, "trailstatus", "基本信息变更", "新增", "商机线索", nowTime, "", -1)
|
|
|
|
+ uodateId4 = AddChangeRecord(tx, clueId, positionId, "top_cluetype", "基本信息变更", topname, "/", nowTime, "", -1)
|
|
|
|
+ uodateId5 = AddChangeRecord(tx, clueId, positionId, "sub_cluetype", "基本信息变更", subname, "/", nowTime, "", -1)
|
|
return clueId > -1 && uodateId1 > -1 && uodateId2 > -1 && uodateId3 > -1 && uodateId4 > -1 && uodateId5 > -1
|
|
return clueId > -1 && uodateId1 > -1 && uodateId2 > -1 && uodateId3 > -1 && uodateId4 > -1 && uodateId5 > -1
|
|
}) {
|
|
}) {
|
|
log.Println("线索分配成功")
|
|
log.Println("线索分配成功")
|