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 }