Browse Source

提交代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.21.12.1
zouap 4 years ago
parent
commit
e98ffbe644
1 changed files with 1 additions and 17 deletions
  1. +1
    -17
      routers/repo/user_data_analysis.go

+ 1
- 17
routers/repo/user_data_analysis.go View File

@@ -4,7 +4,6 @@ import (
"fmt" "fmt"
"net/http" "net/http"
"net/url" "net/url"
"strings"
"time" "time"


"code.gitea.io/gitea/models" "code.gitea.io/gitea/models"
@@ -129,23 +128,8 @@ func QueryUserStaticDataPage(ctx *context.Context) {


//设置默认打开的表单 //设置默认打开的表单
xlsx.SetActiveSheet(index) xlsx.SetActiveSheet(index)
var filename string


nowTime := time.Now()
nowZeroTime := time.Date(nowTime.Year(), nowTime.Month(), nowTime.Day(), 0, 0, 0, 0, nowTime.Location())
if endTime.Unix() >= nowZeroTime.Unix() {
endDate = nowZeroTime.AddDate(0, 0, -1).Format("2006-01-02")
}

if isAll {
filename = sheetName + "_" + ctx.Tr("user.static.all") + ".xlsx"
} else {
filename = sheetName + "_" + strings.ReplaceAll(startDate, "-", "") + "_" + strings.ReplaceAll(endDate, "-", "") + ".xlsx"
}

if len(userName) > 0 {
filename = sheetName + "_" + userName + "_" + strings.ReplaceAll(startDate, "-", "") + "_" + strings.ReplaceAll(endDate, "-", "") + ".xlsx"
}
filename := sheetName + "_" + ctx.Tr("user.static.all") + ".xlsx"


ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+url.QueryEscape(filename)) ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+url.QueryEscape(filename))
ctx.Resp.Header().Set("Content-Type", "application/octet-stream") ctx.Resp.Header().Set("Content-Type", "application/octet-stream")


Loading…
Cancel
Save