fix: 随机提交时间
This commit is contained in:
parent
4ac5c334bd
commit
b8d75df6e5
@ -18,6 +18,7 @@ import (
|
|||||||
"fonchain-fiee/pkg/service/upload"
|
"fonchain-fiee/pkg/service/upload"
|
||||||
"fonchain-fiee/pkg/utils"
|
"fonchain-fiee/pkg/utils"
|
||||||
"fonchain-fiee/pkg/utils/stime"
|
"fonchain-fiee/pkg/utils/stime"
|
||||||
|
"math/rand"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -1556,7 +1557,7 @@ func ImportCompetitiveReportHistoryBatch(ctx *gin.Context) {
|
|||||||
// 第一列:ReportUuid
|
// 第一列:ReportUuid
|
||||||
reportUuid := ""
|
reportUuid := ""
|
||||||
if len(row) > 0 {
|
if len(row) > 0 {
|
||||||
reportUuid = strings.TrimSpace(row[0])
|
reportUuid = utils.CleanString(row[0])
|
||||||
}
|
}
|
||||||
if reportUuid == "" {
|
if reportUuid == "" {
|
||||||
_ = excelData.SetCellValue("Sheet1", cellD, "ReportUuid 不能为空")
|
_ = excelData.SetCellValue("Sheet1", cellD, "ReportUuid 不能为空")
|
||||||
@ -1566,7 +1567,7 @@ func ImportCompetitiveReportHistoryBatch(ctx *gin.Context) {
|
|||||||
// 第二列:Title(可为空)
|
// 第二列:Title(可为空)
|
||||||
title := ""
|
title := ""
|
||||||
if len(row) > 1 {
|
if len(row) > 1 {
|
||||||
title = strings.TrimSpace(row[1])
|
title = utils.CleanString(row[1])
|
||||||
}
|
}
|
||||||
|
|
||||||
// 第三列:SubmitTime
|
// 第三列:SubmitTime
|
||||||
@ -1575,6 +1576,16 @@ func ImportCompetitiveReportHistoryBatch(ctx *gin.Context) {
|
|||||||
submitTime = row[2]
|
submitTime = row[2]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 将 submitTime(YYYY-MM-DD 00:00:00)加随机 9~15 小时、0~59 分钟、0~59 秒,使提交时间更真实
|
||||||
|
if submitTime != "" {
|
||||||
|
if parsedTime, parseErr := time.Parse("2006-01-02 15:04:05", submitTime); parseErr == nil {
|
||||||
|
randomDuration := time.Duration(rand.Intn(7)+9)*time.Hour +
|
||||||
|
time.Duration(rand.Intn(60))*time.Minute +
|
||||||
|
time.Duration(rand.Intn(60))*time.Second
|
||||||
|
submitTime = parsedTime.Add(randomDuration).Format("2006-01-02 15:04:05")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 构造请求
|
// 构造请求
|
||||||
importReq := &cast.ImportCompetitiveReportHistoryReq{
|
importReq := &cast.ImportCompetitiveReportHistoryReq{
|
||||||
ReportUuid: reportUuid,
|
ReportUuid: reportUuid,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user