瀏覽代碼

标签处理

WH01243 7 月之前
父節點
當前提交
66ecc83160
共有 1 個文件被更改,包括 18 次插入31 次删除
  1. 18 31
      clueSync/job.go

+ 18 - 31
clueSync/job.go

@@ -472,7 +472,7 @@ func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
 							"BCPCID":       BCPCID,
 							"operator_id":  -1})
 						//标签处理
-						LabelHandel(nil, label, 2, uId, level, trailstatusCode, gconv.String(clueUpdateData["trailstatus"]), labelChangeTime)
+						LabelHandel(nil, label, 2, uId, level, trailstatusCode, gconv.String(clueUpdateData["trailstatus"]), 1)
 					}
 					clueUpdateData["company_nature"] = isGroup
 					clueUpdateData["company_verification"] = isCommerce
@@ -1273,13 +1273,13 @@ func WorkUpdateClue(data map[string]interface{}, saleData []map[string]interface
 			})
 			//标签处理
 			if old_position_id != positionId && newPositionId > 0 {
-				LabelHandel(tx, label, 1, uId, level, trailstatus, gconv.String(clueUpdateData["trailstatus"]), oldLabelChangeTime)
+				LabelHandel(tx, label, 1, uId, level, trailstatus, gconv.String(clueUpdateData["trailstatus"]), 0)
 			} else {
-				LabelHandel(tx, label, 2, uId, level, trailstatus, gconv.String(clueUpdateData["trailstatus"]), oldLabelChangeTime)
+				LabelHandel(tx, label, 2, uId, level, trailstatus, gconv.String(clueUpdateData["trailstatus"]), 0)
 			}
 		} else {
 			if old_position_id != positionId && newPositionId > 0 {
-				LabelHandel(tx, label, 1, uId, level, trailstatus, gconv.String(clueUpdateData["trailstatus"]), oldLabelChangeTime)
+				LabelHandel(tx, label, 1, uId, level, trailstatus, gconv.String(clueUpdateData["trailstatus"]), 0)
 			}
 		}
 		return ok && updateId1 > -1 && updateId2 > -1 && updateId3 > -1 && updateId4 > -1 && updateId5 > -1 && updateId6 > -1 && updateId7 > -1 && updateId8 > -1 && updateId9 > -1 && updateId10 > -1 && updateId11 > -1 && updateId12 > -1 && updateId13 > -1 && updateId14
@@ -1906,13 +1906,13 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
 				"operator_id":  -1,
 			})
 			if old_position_id != newPositionId && newPositionId > 0 {
-				LabelHandel(tx, label, 1, uId, level, trailstatus, gconv.String(clueUpdateData["trailstatus"]), oldLabelChangeTime)
+				LabelHandel(tx, label, 1, uId, level, trailstatus, gconv.String(clueUpdateData["trailstatus"]), 0)
 			} else {
-				LabelHandel(tx, label, 2, uId, level, trailstatus, gconv.String(clueUpdateData["trailstatus"]), oldLabelChangeTime)
+				LabelHandel(tx, label, 2, uId, level, trailstatus, gconv.String(clueUpdateData["trailstatus"]), 0)
 			}
 		} else {
 			if old_position_id != newPositionId && newPositionId > 0 {
-				LabelHandel(tx, label, 1, uId, level, trailstatus, gconv.String(clueUpdateData["trailstatus"]), oldLabelChangeTime)
+				LabelHandel(tx, label, 1, uId, level, trailstatus, gconv.String(clueUpdateData["trailstatus"]), 0)
 			}
 		}
 		return ok && updateId1 > -1 && updateId2 > -1 && updateId3 > -1 && updateId4 > -1 && updateId5 > -1 && updateId6 > -1 && updateId7 > -1 && updateId8 > -1 && updateId9 > -1 && updateId10 > -1 && updateId11 > -1 && updateId12 > -1 && updateId13 > -1 && updateId14
@@ -2111,7 +2111,7 @@ func clueInfoUpdate(data ClueMapEntity) bool {
 				"BCPCID":       BCPCID,
 				"operator_id":  -1,
 			})
-			LabelHandel(tx, data.Label, 1, data.UId, data.Level, data.Trailstatus, data.Trailstatus, data.LabelChangeTime)
+			LabelHandel(tx, data.Label, 1, data.UId, data.Level, data.Trailstatus, data.Trailstatus, 0)
 		}
 		return ok && updateId1 > -1 && updateId2 > -1 && updateId3 > -1 && updateId4 > -1 && updateId5 > -1 && updateId6 > -1 && updateId7 > -1 && updateId8 > -1 && updateId9 > -1 && updateId10 > -1 && updateId11 > -1 && updateId12 > -1 && updateId13 > -1
 	}) {
@@ -2135,21 +2135,22 @@ func clueInfoUpdate(data ClueMapEntity) bool {
 }
 
 // 线索标签修改 label  labelChangeTime
-func LabelHandel(tx *sql.Tx, oldlabelType, labelType int64, uId, level, oldTrailstatusCode, trailstatusCode, labelChangeTime string) {
-	log.Println("线索标签修改:", oldlabelType, labelType, uId, level, oldTrailstatusCode, trailstatusCode, labelChangeTime)
+func LabelHandel(tx *sql.Tx, oldlabelType, labelType int64, uId, level, oldTrailstatusCode, trailstatusCode string, status int64) {
+	log.Println("线索标签修改:", "oldlabelType:", oldlabelType, "labelType:", labelType, "uId:", uId, "level:", level, "oldTrailstatusCode:", oldTrailstatusCode, "trailstatusCode:", trailstatusCode, "status:", status)
 	//先查询以前什么类型
 	if trailstatusCode != "01" && oldTrailstatusCode != "01" {
+		log.Println("不属于商机类型", uId)
+		return
+	}
+	if status != 0 {
+		log.Println("不属于未完成", uId)
 		return
 	}
 	updateLabelType := int64(0)
 	nowStr := time.Now().Format("2006-01-02")
 	if labelType == 1 {
 		//直接更新
-		if labelChangeTime == nowStr {
-			if oldlabelType != 1 {
-				updateLabelType = labelType
-			}
-		} else {
+		if oldlabelType != 1 {
 			updateLabelType = labelType
 		}
 	} else if labelType == 2 {
@@ -2157,22 +2158,8 @@ func LabelHandel(tx *sql.Tx, oldlabelType, labelType int64, uId, level, oldTrail
 			return
 		}
 		//查询以前是什么数据
-		if labelChangeTime == nowStr {
-			//同一天修改过
-			if oldlabelType != 1 {
-				updateLabelType = labelType
-			}
-		} else {
-			updateLabelType = labelType
-		}
-	} else {
-		//查询以前是什么数据
-		if labelChangeTime == nowStr {
-			//同一天修改过
-			if oldlabelType != 3 {
-				updateLabelType = oldlabelType
-			}
-		} else {
+		//同一天修改过
+		if oldlabelType != 1 {
 			updateLabelType = labelType
 		}
 	}