xuzhiheng 1 rok pred
rodič
commit
bdaca7f8b1
1 zmenil súbory, kde vykonal 33 pridanie a 2 odobranie
  1. 33 2
      service/hlyj.go

+ 33 - 2
service/hlyj.go

@@ -101,7 +101,7 @@ func AutoFollow(this *biservice.CallReq) *biservice.ClueImportResp {
 		clueData := JyBiTidb.FindOne("dwd_f_crm_clue_info", map[string]interface{}{"uid": baseInfoId}, "", "")
 		if clueData != nil {
 			clueId := common.Int64All((*clueData)["baseinfo_id"])
-			callData := CallTidb.FindOne("voice_record", map[string]interface{}{"phone": this.Phone}, "", "")
+			callData := CallTidb.FindOne("voice_record", map[string]interface{}{"CalledNo": this.Phone}, "", "")
 			if callData != nil {
 				callMap := map[string]interface{}{
 					"":            "1",
@@ -127,8 +127,39 @@ func AutoFollow(this *biservice.CallReq) *biservice.ClueImportResp {
 					})
 					updateData["taskstatus"] = 1
 				}
-				updateData["STATE"] = callMap["state"]
+				updateData["STATE"] = callMap[state]
 				JyBiTidb.Update("dwd_f_crm_clue_info", map[string]interface{}{"phone": this.Phone}, updateData)
+			} else {
+				time.Sleep(10 * time.Second)
+				callData := CallTidb.FindOne("voice_record", map[string]interface{}{"phone": this.Phone}, "", "")
+				if callData != nil {
+					callMap := map[string]interface{}{
+						"":            "1",
+						"dealing":     "2",
+						"voicemail":   "3",
+						"notDeal":     "4",
+						"blackList":   "5",
+						"queueLeak":   "6",
+						"leak":        "7",
+						"robotServer": "8",
+						"autoHangup":  "9",
+					}
+					state := common.ObjToString((*callData)["State"])
+					hanguper := common.ObjToString((*callData)["Hanguper"])
+					updateData := map[string]interface{}{}
+					if state != "dealing" && hanguper != "agent" {
+						JyBiTidb.Insert("dwd_f_crm_trail_content", map[string]interface{}{
+							"clue_id":     clueId,
+							"position_id": this.PositionId,
+							"content":     "客户未接通",
+							"operator_id": -1,
+							"createtime":  time.Now().Format(date.Date_Full_Layout),
+						})
+						updateData["taskstatus"] = 1
+					}
+					updateData["STATE"] = callMap["state"]
+					JyBiTidb.Update("dwd_f_crm_clue_info", map[string]interface{}{"phone": this.Phone}, updateData)
+				}
 			}
 		}