time.Now().Format("20060102_150405")

This commit is contained in:
jiangyong27 2023-09-05 16:13:26 +08:00
parent 7118d4c9f6
commit ccffdb1381
1 changed files with 3 additions and 3 deletions

View File

@ -60,7 +60,7 @@ func (s *StaffSalary) Agent(month string, ctx *gin.Context) {
} }
if xls != "" { if xls != "" {
filename := fmt.Sprintf("agent_%d.xlsx", time.Now().Unix()) filename := fmt.Sprintf("agent_%s.xlsx", time.Now().Format("20060102_150405"))
s.toExcel(filename, header, datas, ctx) s.toExcel(filename, header, datas, ctx)
os.Remove(filename) os.Remove(filename)
} else { } else {
@ -118,7 +118,7 @@ func (s *StaffSalary) Bank(month string, ctx *gin.Context) {
} }
if xls != "" { if xls != "" {
filename := fmt.Sprintf("bank_%d.xlsx", time.Now().Unix()) filename := fmt.Sprintf("bank_%s.xlsx", time.Now().Format("20060102_150405"))
s.toExcel(filename, header, datas, ctx) s.toExcel(filename, header, datas, ctx)
os.Remove(filename) os.Remove(filename)
} else { } else {
@ -194,7 +194,7 @@ func (s *StaffSalary) Summary(month string, ctx *gin.Context) {
cast.ToString(summary.RealSalary - summary.SocialInsurence - summary.PersonalTax)}) cast.ToString(summary.RealSalary - summary.SocialInsurence - summary.PersonalTax)})
if xls != "" { if xls != "" {
filename := fmt.Sprintf("summary_%d.xlsx", time.Now().Unix()) filename := fmt.Sprintf("summary_%s.xlsx", time.Now().Format("20060102_150405"))
s.toExcel(filename, header, datas, ctx) s.toExcel(filename, header, datas, ctx)
os.Remove(filename) os.Remove(filename)
} else { } else {