xuzhiheng 1 year ago
parent
commit
2f4a2f3873
1 changed files with 13 additions and 5 deletions
  1. 13 5
      clueSync/job.go

+ 13 - 5
clueSync/job.go

@@ -111,7 +111,7 @@ func saleLeads() {
 func FormatData(data map[string]interface{}, item string) (bool, bool) {
 	userId, uId, positionId, source, cluename, phone, sourceCode, keyword := common.ObjToString(data["user_id"]), "", "", "", "", "", "", []string{}
 	role, industry, department, departments, position, name, top_cluetype, sub_cluetype, follow_project_area, level := "", "", "", "", "", "", "", "", "", ""
-	query, topname, subname, belong_to, sourceName := map[string]interface{}{}, "", "", "01", ""
+	query, topname, subname, belong_to, sourceName, remark := map[string]interface{}{}, "", "", "01", "", ""
 	nowTime := time.Now().Format("2006-01-02 15:04:05")
 	if item == "orders" { //订单
 		if !mongodb.IsObjectIdHex(userId) {
@@ -187,6 +187,7 @@ func FormatData(data map[string]interface{}, item string) (bool, bool) {
 		position = common.ObjToString(data["position"])
 		name = common.ObjToString(data["name"])
 		sourceCode = common.ObjToString(data["source"])
+		remark = common.ObjToString(data["jyRemark"])
 		keywordArr := data["keyword"]
 		if keywordArr != nil {
 			keyword = common.ObjArrToStringArr(data["keyword"].([]interface{}))
@@ -308,9 +309,9 @@ func FormatData(data map[string]interface{}, item string) (bool, bool) {
 			if batch_import != "" && item == "users" {
 				return true, true
 			}
-			oks = UpdateClue(*uCount, saleData, item, userId, uId, top_cluetype, sub_cluetype, topname, subname, cluename, name, saleName, phone, position, department, departments, industry, follow_project_area, role, seatNumber, level, position_id, source, sourceCode, keyword, belong_to, isGroup, isCommerce, pIsOk)
+			oks = UpdateClue(*uCount, saleData, item, userId, uId, top_cluetype, sub_cluetype, topname, subname, cluename, name, saleName, phone, position, department, departments, industry, follow_project_area, role, seatNumber, level, position_id, source, sourceCode, remark, keyword, belong_to, isGroup, isCommerce, pIsOk)
 		} else {
-			oks = SaveClue(item, userId, uId, top_cluetype, sub_cluetype, topname, subname, cluename, name, saleName, phone, position, department, departments, industry, follow_project_area, role, seatNumber, position_id, source, sourceCode, keyword, belong_to, isGroup, isCommerce)
+			oks = SaveClue(item, userId, uId, top_cluetype, sub_cluetype, topname, subname, cluename, name, saleName, phone, position, department, departments, industry, follow_project_area, role, seatNumber, position_id, source, sourceCode, remark, keyword, belong_to, isGroup, isCommerce)
 			if oks {
 				TiDb.UpdateOrDeleteBySql(`update dwd_f_crm_clue_autodraw_record set count = count + 1 where seatNumber = ? and clue_level = ?`, seatNumber, level)
 			}
@@ -323,7 +324,7 @@ func FormatData(data map[string]interface{}, item string) (bool, bool) {
 	return true, true
 }
 
-func SaveClue(item, userId, uId, top_cluetype, sub_cluetype, topname, subname, cluename, name, saleName, phone, position, department, departments, industry, follow_project_area, role, seatNumber string, positionId int64, source, sourceCode string, keyword []string, belong_to string, isGroup, isCommerce int) bool {
+func SaveClue(item, userId, uId, top_cluetype, sub_cluetype, topname, subname, cluename, name, saleName, phone, position, department, departments, industry, follow_project_area, role, seatNumber string, positionId int64, source, sourceCode, remark string, keyword []string, belong_to string, isGroup, isCommerce int) bool {
 	nowTime := time.Now().Format("2006-01-02 15:04:05")
 	nowTimes := time.Unix(time.Now().Unix()+3600*12, 0).Format("2006-01-02 15:04:05")
 	clueId, uodateId1, uodateId2, uodateId3, uodateId4, uodateId5, uodateId6 := int64(0), int64(0), int64(0), int64(0), int64(0), int64(0), int64(0)
@@ -366,6 +367,7 @@ func SaveClue(item, userId, uId, top_cluetype, sub_cluetype, topname, subname, c
 			"business_scope":       common.If(sourceCode == "app_xzcyh", keywords, nil),
 			"company_nature":       isGroup,
 			"company_verification": isCommerce,
+			"remark":               remark,
 		})
 		uodateId1 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
 			"clue_id":     clueId,
@@ -450,7 +452,7 @@ func SaveClue(item, userId, uId, top_cluetype, sub_cluetype, topname, subname, c
 	}
 }
 
-func UpdateClue(data map[string]interface{}, saleData []map[string]interface{}, item, userId, uId, top_cluetype, sub_cluetype, topname, subname, cluename, name, saleName, phone, position, department, departments, industry, follow_project_area, role, seatNumber, level string, positionId int64, source, sourceCode string, keyword []string, belong_to string, isGroup, isCommerce int, pIsOk bool) bool {
+func UpdateClue(data map[string]interface{}, saleData []map[string]interface{}, item, userId, uId, top_cluetype, sub_cluetype, topname, subname, cluename, name, saleName, phone, position, department, departments, industry, follow_project_area, role, seatNumber, level string, positionId int64, source, sourceCode, remark string, keyword []string, belong_to string, isGroup, isCommerce int, pIsOk bool) bool {
 	nowTime := time.Now().Format("2006-01-02 15:04:05")
 	nowTimes := time.Unix(time.Now().Unix()+3600*12, 0).Format("2006-01-02 15:04:05")
 	//trailstatus = 无意向 为变更线索状态
@@ -535,9 +537,15 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
 		"company_nature":       isGroup,
 		"company_verification": isCommerce,
 	}
+	old_remark := common.ObjToString(data["remark"])
+	if old_remark != "" {
+		remark = old_remark + ";" + remark
+	}
+	clueUpdateData["remark"] = remark
 	if cluename != "" {
 		clueUpdateData["cluename"] = cluename
 	}
+
 	if item != "orders" && item != "users" {
 		if name != "" {
 			clueUpdateData["name"] = name