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