Browse Source

fix-bug

tags/v1.22.6.1^2
liuzx 3 years ago
parent
commit
23678e5968
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      routers/api/v1/repo/cloudbrain_dashboard.go

+ 4
- 4
routers/api/v1/repo/cloudbrain_dashboard.go View File

@@ -1259,7 +1259,7 @@ func getCloudbrainTimePeroid(ctx *context.Context, recordBeginTime time.Time) (t
endTime = now
} else if queryType == "current_month" {
endTime = now
beginTime = time.Date(endTime.Year(), endTime.Month(), 2, 0, 0, 0, 0, now.Location())
beginTime = time.Date(endTime.Year(), endTime.Month(), 1, 0, 0, 0, 0, now.Location())
} else if queryType == "monthly" {
endTime = now
beginTime = now.AddDate(0, -1, 1)
@@ -1267,13 +1267,13 @@ func getCloudbrainTimePeroid(ctx *context.Context, recordBeginTime time.Time) (t

} else if queryType == "current_year" {
endTime = now
beginTime = time.Date(endTime.Year(), 1, 2, 0, 0, 0, 0, now.Location())
beginTime = time.Date(endTime.Year(), 1, 1, 0, 0, 0, 0, now.Location())

} else if queryType == "last_month" {

lastMonthTime := now.AddDate(0, -1, 0)
beginTime = time.Date(lastMonthTime.Year(), lastMonthTime.Month(), 2, 0, 0, 0, 0, now.Location())
endTime = time.Date(now.Year(), now.Month(), 2, 0, 0, 0, 0, now.Location())
beginTime = time.Date(lastMonthTime.Year(), lastMonthTime.Month(), 1, 0, 0, 0, 0, now.Location())
endTime = time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, now.Location())

} else {
return now, now, fmt.Errorf("The value of type parameter is wrong.")


Loading…
Cancel
Save