Browse Source

铁塔数据导入

xuzhiheng 1 year ago
parent
commit
9f5cf79c13
1 changed files with 16 additions and 0 deletions
  1. 16 0
      service/clue.go

+ 16 - 0
service/clue.go

@@ -64,6 +64,7 @@ func ClueImportTtSync(this *biservice.ClueImportReq) (string, int) {
 				if dataId > 0 {
 					JyTidb.Insert("customer_data_ttzl_gl", map[string]interface{}{"msg_id": dataId, "info_id": id, "details": details, "isHistory": "否"})
 					delete(v, "isCompetitors")
+					v["details"] = cleanHTML(details)
 					ok := Es.Save("ttbid", "ttbid", v)
 					if ok {
 						counts++
@@ -91,6 +92,21 @@ func ClueImportTtSync(this *biservice.ClueImportReq) (string, int) {
 	}
 }
 
+func cleanHTML(htmlString string) string {
+	// 清理HTML标签
+	htmlRegex := regexp.MustCompile("<[^>]*>")
+	cleanedString := htmlRegex.ReplaceAllString(htmlString, "")
+
+	// 清理换行符和制表符
+	cleanedString = strings.ReplaceAll(cleanedString, "\n", "")
+	cleanedString = strings.ReplaceAll(cleanedString, "\t", "")
+
+	// 清理多余的空格
+	cleanedString = strings.TrimSpace(cleanedString)
+
+	return cleanedString
+}
+
 func ClueAdd(this *biservice.ClueAddReq, col string) *biservice.AddProjectResp {
 	status := 1
 	nowTime := time.Now().Format(date.Date_Full_Layout)