From 9fcf389165dd1d11c41ac2b4cff822feb3226e12 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Thu, 11 Nov 2021 10:58:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=BB=9F=E8=AE=A1=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=E6=97=B6=E9=97=B4=E5=92=8C=E7=BB=93=E6=9D=9F=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E4=BB=A3=E7=A0=81bug=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/api/v1/repo/repo_dashbord.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/routers/api/v1/repo/repo_dashbord.go b/routers/api/v1/repo/repo_dashbord.go index 4555d8a5c..975c3aa00 100644 --- a/routers/api/v1/repo/repo_dashbord.go +++ b/routers/api/v1/repo/repo_dashbord.go @@ -198,7 +198,7 @@ func getFileName(ctx *context.Context, beginTime time.Time, endTime time.Time) s if ctx.QueryTrim("q") != "" { baseName = baseName + ctx.QueryTrim("q") + "_" } - baseName = baseName + beginTime.Format(DATE_FORMAT) + "_to_" + endTime.Format(DATE_FORMAT) + "_" + strconv.FormatInt(time.Now().Unix(), 10) + ".csv" + baseName = baseName + beginTime.AddDate(0, 0, -1).Format(DATE_FORMAT) + "_to_" + endTime.AddDate(0, 0, -1).Format(DATE_FORMAT) + "_" + strconv.FormatInt(time.Now().Unix(), 10) + ".csv" return baseName } @@ -424,7 +424,7 @@ func getTimePeroid(ctx *context.Context, recordBeginTime time.Time) (time.Time, endTimeStr := ctx.QueryTrim("endTime") var beginTime time.Time var endTime time.Time - + var err error if queryType != "" { if queryType == "all" { @@ -469,12 +469,12 @@ func getTimePeroid(ctx *context.Context, recordBeginTime time.Time) (time.Time, } else { - beginTime, err := time.Parse("2006-01-02", beginTimeStr) + beginTime, err = time.Parse("2006-01-02", beginTimeStr) if err != nil { return now, now, err } - endTime, err := time.Parse("2006-01-02", endTimeStr) + endTime, err = time.Parse("2006-01-02", endTimeStr) if err != nil { return now, now, err }