Jianghan hai 1 ano
pai
achega
d4cd56ef77
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      CMPlatform/service/data_ent.go

+ 4 - 0
CMPlatform/service/data_ent.go

@@ -95,6 +95,8 @@ func ImportDataByExcel(mf multipart.File, eid int64, entid string) (int, int64,
 	defer common.Catch()
 	now := time.Now()
 	importDataNum := 0
+
+	var numLock sync.Mutex
 	var saveEsArr []map[string]interface{}
 	binary, _ := io.ReadAll(mf)
 	xls, _ := xlsx.OpenBinary(binary)
@@ -209,7 +211,9 @@ func ImportDataByExcel(mf multipart.File, eid int64, entid string) (int, int64,
 			if tmp["infoid"] == nil {
 				return
 			}
+			numLock.Lock()
 			importDataNum++
+			numLock.Unlock()
 			if common.ObjToString(tmp["href"]) == "#" || strings.Contains(common.ObjToString(tmp["href"]), "jianyu360.cn") {
 				tmp["isCompetitors"] = "是"
 			} else {