修改导出文件并删除
This commit is contained in:
parent
7ad44130a2
commit
c092ced2c2
@ -6,7 +6,6 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/360EntSecGroup-Skylar/excelize"
|
||||
@ -195,13 +194,6 @@ func ExportRegister(c *gin.Context) {
|
||||
response.ResponseQuickMsg(c, msg.Fail, err.Error(), nil)
|
||||
return
|
||||
}
|
||||
defer func() {
|
||||
if err := os.Remove(filePath); err != nil {
|
||||
logger.Errorf("删除临时文件失败: %v", err)
|
||||
} else {
|
||||
logger.Info("临时文件已清理:", filePath)
|
||||
}
|
||||
}()
|
||||
var httpType string
|
||||
if config.Data.System.IsHttps {
|
||||
httpType = model.HttpsType
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -80,10 +79,6 @@ func ToExcelByType(titleList []string, dataList []interface{}, dataType string,
|
||||
var buffer bytes.Buffer
|
||||
_ = file.Write(&buffer)
|
||||
if filePath != "" {
|
||||
dir := filepath.Dir(filePath)
|
||||
if err = CreateDirPath(dir); err != nil {
|
||||
return
|
||||
}
|
||||
if err = file.Save(filePath); err != nil {
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user