feat: 网元文件操作可删除本地临时文件
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"be.ems/src/framework/i18n"
|
||||
@@ -85,6 +86,7 @@ func (s *TcpdumpController) DumpDownload(c *gin.Context) {
|
||||
NeType string `form:"neType" binding:"required"` // 网元类型
|
||||
NeID string `form:"neId" binding:"required"` // 网元ID
|
||||
TaskCode string `form:"taskCode" binding:"required"` // 任务码,停止任务并查看日志信息
|
||||
DelTemp bool `form:"delTemp"` // 完成后是否删除本地临时zip文件
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
||||
@@ -96,6 +98,12 @@ func (s *TcpdumpController) DumpDownload(c *gin.Context) {
|
||||
c.JSON(200, result.ErrMsg(i18n.TKey(language, err.Error())))
|
||||
return
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if query.DelTemp {
|
||||
_ = os.Remove(zipFilePath)
|
||||
}
|
||||
}()
|
||||
c.FileAttachment(zipFilePath, filepath.Base(zipFilePath))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user