瀏覽代碼

Merge branch 'fix/2023-01-09' into debug

# Conflicts:
#	models/tables/yb_config/entity.go
Roc 2 年之前
父節點
當前提交
4a5cb9712c
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      services/chart/predict_edb_info.go

+ 8 - 1
services/chart/predict_edb_info.go

@@ -268,11 +268,18 @@ func getPredictEdbDayList(startDate, endDate time.Time, frequency string) (dayLi
 	case "月度":
 		for currDate := startDate; currDate.Before(endDate) || currDate.Equal(endDate); {
 			currDate = time.Date(currDate.Year(), currDate.Month(), 1, 0, 0, 0, 0, time.Now().Location()).AddDate(0, 1, -1)
-			if !currDate.After(endDate) {
+			if !currDate.After(endDate) && !currDate.Equal(startDate) {
 				dayList = append(dayList, currDate)
 			}
 			currDate = currDate.AddDate(0, 0, 1)
 		}
+	case "年度":
+		for currDate := startDate; currDate.Before(endDate) || currDate.Equal(endDate); {
+			currDate = time.Date(currDate.Year()+1, 12, 31, 0, 0, 0, 0, time.Now().Location())
+			if !currDate.After(endDate) && !currDate.Equal(startDate) {
+				dayList = append(dayList, currDate)
+			}
+		}
 	}
 	return
 }