Przeglądaj źródła

fix: 图表自定义时间

hsun 3 lat temu
rodzic
commit
d593152a16
1 zmienionych plików z 8 dodań i 2 usunięć
  1. 8 2
      controller/chart/chart_info.go

+ 8 - 2
controller/chart/chart_info.go

@@ -82,6 +82,7 @@ func GetChartInfoDetail(c *gin.Context)  {
 	if dateType <= 0 {
 		dateType = 3	// 默认同后台15年至今
 	}
+
 	switch dateType {
 	case 1:
 		startDate = "2000-01-01"
@@ -92,8 +93,13 @@ func GetChartInfoDetail(c *gin.Context)  {
 	case 4:
 		startDate = "2021-01-01"
 	case 5:
-		startDate = startDate + "-01"
-		endDate = endDate + "-01"
+		if startDate == "" && chartInfo.StartDate != "" {
+			startDate = chartInfo.StartDate
+			endDate = chartInfo.EndDate
+		} else {
+			startDate = startDate + "-01"
+			endDate = endDate + "-01"
+		}
 	case 6:
 		startDate = startDate + "-01"
 	case 7: