|
@@ -68,31 +68,20 @@ func ClueImportTtSync(this *biservice.ClueImportReq) (string, int) {
|
|
delete(v, "projectId")
|
|
delete(v, "projectId")
|
|
id_new := common.GetMd5String(fmt.Sprintf("%s_%d", common.ObjToString(v["id"]), common.Int64All(v["multipackage_id"])))
|
|
id_new := common.GetMd5String(fmt.Sprintf("%s_%d", common.ObjToString(v["id"]), common.Int64All(v["multipackage_id"])))
|
|
v["id_new"] = id_new
|
|
v["id_new"] = id_new
|
|
- customer_data := BiService.FindOne("customer_data_ttzl", map[string]interface{}{"id_new": id_new}, "", "")
|
|
|
|
- if customer_data != nil {
|
|
|
|
|
|
+ if BiService.Count("customer_data_ttzl", map[string]interface{}{"id_new": id_new}) > 0 {
|
|
log.Println("数据重复", id)
|
|
log.Println("数据重复", id)
|
|
- if BiService.Update("customer_data_ttzl", map[string]interface{}{"msg_id": common.Int64All((*customer_data)["msg_id"])}, v) {
|
|
|
|
- if _, ok := CreateEs(v); ok {
|
|
|
|
- counts++
|
|
|
|
- log.Println("es更新成功", id)
|
|
|
|
- } else {
|
|
|
|
- log.Println("es更新失败!!", id)
|
|
|
|
- }
|
|
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if dataId := BiService.Insert("customer_data_ttzl", v); dataId > 0 {
|
|
|
|
+ if details, ok := CreateEs(v); ok {
|
|
|
|
+ BiService.Insert("customer_data_ttzl_gl", map[string]interface{}{"msg_id": dataId, "info_id": id, "details": details, "isHistory": "否"})
|
|
|
|
+ counts++
|
|
|
|
+ log.Println("es存入成功", id)
|
|
} else {
|
|
} else {
|
|
- log.Println("tidb更新失败!!", id)
|
|
|
|
|
|
+ log.Println("es存入失败!!", id)
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- if dataId := BiService.Insert("customer_data_ttzl", v); dataId > 0 {
|
|
|
|
- if details, ok := CreateEs(v); ok {
|
|
|
|
- BiService.Insert("customer_data_ttzl_gl", map[string]interface{}{"msg_id": dataId, "info_id": id, "details": details, "isHistory": "否"})
|
|
|
|
- counts++
|
|
|
|
- log.Println("es存入成功", id)
|
|
|
|
- } else {
|
|
|
|
- log.Println("es存入失败!!", id)
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- log.Println("tidb存入失败!!", id)
|
|
|
|
- }
|
|
|
|
|
|
+ log.Println("tidb存入失败!!", id)
|
|
}
|
|
}
|
|
}(v)
|
|
}(v)
|
|
}
|
|
}
|