|
@@ -263,25 +263,136 @@ func FormatData(data map[string]interface{}, item string) (bool, bool) {
|
|
} else {
|
|
} else {
|
|
//留资线索更新
|
|
//留资线索更新
|
|
if item != "orders" && item != "users" { //新用户和订单之外的替换一下新的留资信息
|
|
if item != "orders" && item != "users" { //新用户和订单之外的替换一下新的留资信息
|
|
|
|
+ BCPCID := common.GetRandom(32)
|
|
|
|
+ clueId := common.Int64All((*uCount)["id"])
|
|
|
|
+ old_name := common.ObjToString((*uCount)["name"])
|
|
|
|
+ old_position := common.ObjToString((*uCount)["position"])
|
|
|
|
+ old_department := common.ObjToString((*uCount)["department"])
|
|
|
|
+ old_follow_project_area := common.ObjToString((*uCount)["follow_project_area"])
|
|
|
|
+ old_role := common.ObjToString((*uCount)["role"])
|
|
|
|
+ old_cluename := common.ObjToString((*uCount)["cluename"])
|
|
|
|
+ old_top_cluetype := common.ObjToString((*uCount)["top_cluetype"])
|
|
|
|
+ old_sub_cluetype := common.ObjToString((*uCount)["sub_cluetype"])
|
|
clueUpdateData := map[string]interface{}{}
|
|
clueUpdateData := map[string]interface{}{}
|
|
- if name != "" {
|
|
|
|
|
|
+ if old_name != name && name != "" {
|
|
clueUpdateData["name"] = name
|
|
clueUpdateData["name"] = name
|
|
|
|
+ fmt.Println("1234", TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
+ "clue_id": clueId,
|
|
|
|
+ "change_field": "name",
|
|
|
|
+ "position_id": 0,
|
|
|
|
+ "change_type": "基本信息变更",
|
|
|
|
+ "old_value": common.If(old_name != "", old_name, "/"),
|
|
|
|
+ "new_value": common.If(name != "", name, "/"),
|
|
|
|
+ "createtime": nowTime,
|
|
|
|
+ "BCPCID": BCPCID,
|
|
|
|
+ "operator_id": -1}))
|
|
}
|
|
}
|
|
- if position != "" {
|
|
|
|
|
|
+ if old_position != position && position != "" {
|
|
clueUpdateData["position"] = position
|
|
clueUpdateData["position"] = position
|
|
|
|
+ TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
+ "clue_id": clueId,
|
|
|
|
+ "change_field": "position",
|
|
|
|
+ "position_id": 0,
|
|
|
|
+ "change_type": "基本信息变更",
|
|
|
|
+ "old_value": common.If(old_position != "", old_position, "/"),
|
|
|
|
+ "new_value": common.If(position != "", position, "/"),
|
|
|
|
+ "createtime": nowTime,
|
|
|
|
+ "BCPCID": BCPCID,
|
|
|
|
+ "operator_id": -1})
|
|
}
|
|
}
|
|
- if department != "" {
|
|
|
|
|
|
+ if old_department != department && department != "" {
|
|
clueUpdateData["department"] = department
|
|
clueUpdateData["department"] = department
|
|
|
|
+ TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
+ "clue_id": clueId,
|
|
|
|
+ "change_field": "department",
|
|
|
|
+ "position_id": 0,
|
|
|
|
+ "change_type": "基本信息变更",
|
|
|
|
+ "old_value": common.If(old_department != "", old_department, "/"),
|
|
|
|
+ "new_value": common.If(department != "", department, "/"),
|
|
|
|
+ "createtime": nowTime,
|
|
|
|
+ "BCPCID": BCPCID,
|
|
|
|
+ "operator_id": -1})
|
|
}
|
|
}
|
|
- if follow_project_area != "" {
|
|
|
|
|
|
+ if old_follow_project_area != follow_project_area && follow_project_area != "" {
|
|
clueUpdateData["follow_project_area"] = follow_project_area
|
|
clueUpdateData["follow_project_area"] = follow_project_area
|
|
|
|
+ TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
+ "clue_id": clueId,
|
|
|
|
+ "change_field": "follow_project_area",
|
|
|
|
+ "position_id": 0,
|
|
|
|
+ "change_type": "基本信息变更",
|
|
|
|
+ "old_value": common.If(old_follow_project_area != "", old_follow_project_area, "/"),
|
|
|
|
+ "new_value": common.If(follow_project_area != "", follow_project_area, "/"),
|
|
|
|
+ "createtime": nowTime,
|
|
|
|
+ "BCPCID": BCPCID,
|
|
|
|
+ "operator_id": -1})
|
|
}
|
|
}
|
|
- if role != "" {
|
|
|
|
- clueUpdateData["role"] = role
|
|
|
|
|
|
+ if old_role != role && role != "" {
|
|
|
|
+ TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
+ "clue_id": clueId,
|
|
|
|
+ "change_field": "role",
|
|
|
|
+ "change_type": "基本信息变更",
|
|
|
|
+ "old_value": common.If(old_role != "", old_role, "/"),
|
|
|
|
+ "new_value": common.If(role != "", role, "/"),
|
|
|
|
+ "createtime": nowTime,
|
|
|
|
+ "position_id": 0,
|
|
|
|
+ "BCPCID": BCPCID,
|
|
|
|
+ "operator_id": -1})
|
|
}
|
|
}
|
|
- if cluename != "" {
|
|
|
|
|
|
+ if old_cluename != cluename && cluename != "" {
|
|
clueUpdateData["cluename"] = cluename //新的线索名不为空才替换
|
|
clueUpdateData["cluename"] = cluename //新的线索名不为空才替换
|
|
|
|
+ TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
+ "clue_id": clueId,
|
|
|
|
+ "change_field": "cluename",
|
|
|
|
+ "change_type": "基本信息变更",
|
|
|
|
+ "old_value": common.If(old_cluename != "", old_cluename, "/"),
|
|
|
|
+ "new_value": common.If(cluename != "", cluename, "/"),
|
|
|
|
+ "createtime": nowTime,
|
|
|
|
+ "BCPCID": BCPCID,
|
|
|
|
+ "position_id": 0,
|
|
|
|
+ "operator_id": -1})
|
|
}
|
|
}
|
|
|
|
+ old_topname := ""
|
|
|
|
+ old_subname := ""
|
|
|
|
+ if old_top_cluetype != "" {
|
|
|
|
+ pcodeData := TiDb.FindOne("dwd_d_crm_cluetype_code", map[string]interface{}{"code": old_top_cluetype}, "", "")
|
|
|
|
+ if pcodeData != nil && len(*pcodeData) > 0 {
|
|
|
|
+ old_topname = common.ObjToString((*pcodeData)["name"])
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if old_sub_cluetype != "" {
|
|
|
|
+ pcodeData := TiDb.FindOne("dwd_d_crm_cluetype_code", map[string]interface{}{"code": old_sub_cluetype}, "", "")
|
|
|
|
+ if pcodeData != nil && len(*pcodeData) > 0 {
|
|
|
|
+ old_subname = common.ObjToString((*pcodeData)["name"])
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if old_top_cluetype != top_cluetype && top_cluetype != "" {
|
|
|
|
+ clueUpdateData["top_cluetype"] = top_cluetype //新的线索名不为空才替换
|
|
|
|
+ TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
+ "clue_id": clueId,
|
|
|
|
+ "change_field": "top_cluetype",
|
|
|
|
+ "position_id": 0,
|
|
|
|
+ "change_type": "基本信息变更",
|
|
|
|
+ "old_value": common.If(old_topname != "", old_topname, "/"),
|
|
|
|
+ "new_value": common.If(topname != "", topname, "/"),
|
|
|
|
+ "createtime": nowTime,
|
|
|
|
+ "BCPCID": BCPCID,
|
|
|
|
+ "operator_id": -1})
|
|
|
|
+ }
|
|
|
|
+ if old_sub_cluetype != sub_cluetype && sub_cluetype != "" {
|
|
|
|
+ clueUpdateData["sub_cluetype"] = sub_cluetype //新的线索名不为空才替换
|
|
|
|
+ TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
|
+ "clue_id": clueId,
|
|
|
|
+ "change_field": "sub_cluetype",
|
|
|
|
+ "position_id": 0,
|
|
|
|
+ "change_type": "基本信息变更",
|
|
|
|
+ "old_value": common.If(old_subname != "", old_subname, "/"),
|
|
|
|
+ "new_value": common.If(subname != "", subname, "/"),
|
|
|
|
+ "createtime": nowTime,
|
|
|
|
+ "BCPCID": BCPCID,
|
|
|
|
+ "operator_id": -1})
|
|
|
|
+ }
|
|
|
|
+ clueUpdateData["company_nature"] = isGroup
|
|
|
|
+ clueUpdateData["company_verification"] = isCommerce
|
|
TiDb.Update("dwd_f_crm_clue_info", map[string]interface{}{"uid": uId}, clueUpdateData)
|
|
TiDb.Update("dwd_f_crm_clue_info", map[string]interface{}{"uid": uId}, clueUpdateData)
|
|
}
|
|
}
|
|
}
|
|
}
|