Ver código fonte

Merge branch 'feature/eta_forum3_chart_classify' into debug

xyxie 1 semana atrás
pai
commit
19899779ca
1 arquivos alterados com 5 adições e 1 exclusões
  1. 5 1
      controllers/edb_data.go

+ 5 - 1
controllers/edb_data.go

@@ -45,6 +45,7 @@ func (this *EdbDataController) SaveByBinlog() {
 	reqList := make([]*models.EdbDataBinlogItem, 0)
 	// 判断指标库里是否存在这些指标,如果不存在,则丢弃,无需处理
 	edbInfoIds := make([]int, 0)
+	idMap := make(map[int]bool)
 	for _, item := range req.List {
 		// 解析json
 		var dataItem models.EdbDataBinlogItem
@@ -55,7 +56,10 @@ func (this *EdbDataController) SaveByBinlog() {
 		}
 		dataItem.OpType = item.OpType
 		reqList = append(reqList, &dataItem)
-		edbInfoIds = append(edbInfoIds, dataItem.EdbInfoId)
+		if _, ok := idMap[dataItem.EdbInfoId]; !ok {
+			idMap[dataItem.EdbInfoId] = true
+			edbInfoIds = append(edbInfoIds, dataItem.EdbInfoId)
+		}
 	}
 	// 查询指标信息
 	edbInfoList, err := models.GetEdbInfoByIdList(edbInfoIds)