hsun 1 ano atrás
pai
commit
b294114977

+ 1 - 0
controllers/data_manage/chart_info.go

@@ -1740,6 +1740,7 @@ func (this *ChartInfoController) ChartInfoBase64Upload() {
 
 	defer func() {
 		os.Remove(fileName)
+		os.Remove(outFileName)
 	}()
 
 	//saveToOssPath = uploadDir + time.Now().Format("200601/20060102/")

+ 8 - 0
controllers/resource.go

@@ -254,6 +254,10 @@ func (this *ResourceController) VideoUpload() {
 	//savePath := utils.Upload_Audio_Dir + time.Now().Format("200601/20060102/")
 	//savePath += fileName
 
+	defer func() {
+		_ = os.Remove(fpath)
+	}()
+
 	//上传到阿里云 和 minio
 	resourceUrl := ``
 	//if utils.ObjectStorageClient == "minio" {
@@ -441,6 +445,10 @@ func (this *ResourceController) VoiceUpload() {
 	utils.FileLog.Info("start update oss ")
 	utils.FileLog.Info(fmt.Sprintf("%s:", time.Now().Format(utils.FormatDateTime)))
 
+	defer func() {
+		_ = os.Remove(fpath)
+	}()
+
 	//savePath := utils.Upload_Audio_Dir + time.Now().Format("200601/20060102/")
 	//savePath += fileName
 	//上传到阿里云 和 minio

+ 0 - 2
services/aws_s3.go

@@ -9,7 +9,6 @@ import (
 	"github.com/aws/aws-sdk-go/aws/session"
 	"github.com/aws/aws-sdk-go/service/s3"
 	"io/ioutil"
-	"os"
 	"time"
 )
 
@@ -59,7 +58,6 @@ func (m *S3Oss) UploadFile(fileName, localFile, savePath string) (resourceUrl st
 		if err != nil {
 			fmt.Println(err.Error())
 		}
-		_ = os.Remove(localFile)
 	}()
 
 	endpoint := utils.S3Endpoint

+ 0 - 4
services/minio.go

@@ -7,7 +7,6 @@ import (
 	"github.com/minio/minio-go/v7"
 	"github.com/minio/minio-go/v7/pkg/credentials"
 	"log"
-	"os"
 	"time"
 )
 
@@ -352,9 +351,6 @@ type MinioOss struct{}
 
 // UploadFile 上传文件
 func (m *MinioOss) UploadFile(fileName, filePath, savePath string) (string, error) {
-	defer func() {
-		_ = os.Remove(filePath)
-	}()
 	if utils.MinIoAccessKeyId == `` || utils.MinIoAccessKeySecret == `` {
 		return "0", errors.New("MinIo信息未配置")
 	}

+ 0 - 4
services/oss.go

@@ -6,7 +6,6 @@ import (
 	"eta/eta_mobile/services/alarm_msg"
 	"fmt"
 	"github.com/aliyun/aliyun-oss-go-sdk/oss"
-	"os"
 	"time"
 
 	"eta/eta_mobile/utils"
@@ -294,9 +293,6 @@ type AliOss struct{}
 
 // UploadFile 上传文件
 func (m *AliOss) UploadFile(fileName, filePath, savePath string) (string, error) {
-	defer func() {
-		_ = os.Remove(filePath)
-	}()
 	if utils.AccessKeyId == `` {
 		return "0", errors.New("阿里云信息未配置")
 	}