Browse Source

fix:指标季度数据计算 季节图没有数据时,碰到处理情况,空切片返回

Roc 2 years ago
parent
commit
ba62ed83ec
1 changed files with 4 additions and 0 deletions
  1. 4 0
      models/chart.go

+ 4 - 0
models/chart.go

@@ -140,6 +140,10 @@ func AddCalculateQuarterV5(dataList []*EdbDataList) (result *EdbDataResult, err
 			fmt.Println("errMsg:", errMsg)
 		}
 	}()
+	if len(dataList) <= 0 {
+		result.List = make([]*EdbDataItems, 0)
+		return
+	}
 
 	endDate := dataList[len(dataList)-1].DataTime
 	endDateForm, err := time.Parse(utils.FormatDate, endDate)