瀏覽代碼

优化计算指标数据刷新

hongze 2 月之前
父節點
當前提交
52c53e9498
共有 1 個文件被更改,包括 16 次插入0 次删除
  1. 16 0
      services/data/edb_info.go

+ 16 - 0
services/data/edb_info.go

@@ -263,8 +263,24 @@ func RefreshDataFromCalculateAll() (err error) {
 	if err != nil {
 		return err
 	}
+
+	nowStr := time.Now().AddDate(0, 0, -1).Format(utils.FormatDate)
+
+	startDateOfWeek := utils.GetNowWeekMonday()
+	endDateOfWeek := utils.GetNowWeekLastDay()
+
 	for _, v := range items {
 
+		if v.Frequency == "日度" {
+			if v.EndDate.Format(utils.FormatDate) == nowStr {
+				continue
+			}
+		} else if v.Frequency == "周度" {
+			if !v.EndDate.Before(startDateOfWeek) && !v.EndDate.After(endDateOfWeek) {
+				continue
+			}
+		}
+
 		source := v.Source
 		startDate := v.StartDate.Format(utils.FormatDate)
 		if startDate == "0001-01-01" {