|
@@ -7,7 +7,6 @@ import (
|
|
|
"fmt"
|
|
|
"github.com/minio/minio-go/v7"
|
|
|
"github.com/minio/minio-go/v7/pkg/credentials"
|
|
|
- "log"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -425,13 +424,14 @@ func (m *MinioOss) UploadFile(fileName, filePath, savePath string) (string, erro
|
|
|
Secure: useSSL,
|
|
|
})
|
|
|
if err != nil {
|
|
|
- log.Fatalln(err)
|
|
|
+ utils.FileLog.Error("MinIo连接失败:", err)
|
|
|
return "1", err
|
|
|
}
|
|
|
bucketName := utils.MinIoBucketname
|
|
|
exists, errBucketExists := minioClient.BucketExists(ctx, bucketName)
|
|
|
if errBucketExists != nil || !exists {
|
|
|
err = fmt.Errorf("BucketExists: %v; err: %v", exists, errBucketExists)
|
|
|
+ utils.FileLog.Error("BucketExists: %v; err: %v", exists, errBucketExists)
|
|
|
return "2", err
|
|
|
}
|
|
|
|
|
@@ -441,7 +441,7 @@ func (m *MinioOss) UploadFile(fileName, filePath, savePath string) (string, erro
|
|
|
}
|
|
|
_, err = minioClient.FPutObject(ctx, bucketName, path, filePath, minio.PutObjectOptions{})
|
|
|
if err != nil {
|
|
|
- log.Fatalln(err)
|
|
|
+ utils.FileLog.Error("MinIo上传文件失败:", err)
|
|
|
return "3", err
|
|
|
}
|
|
|
resourceUrl := utils.MinIoImghost + path
|