Browse Source

fix minio

ziwen 1 year ago
parent
commit
83137bc3e6
1 changed files with 4 additions and 1 deletions
  1. 4 1
      services/minio.go

+ 4 - 1
services/minio.go

@@ -137,6 +137,7 @@ func UploadImgToMinIo(fileName, filePath string) (string, error) {
 	})
 	if err != nil {
 		log.Fatalln(err)
+		return "1", err
 	}
 	bucketName := utils.MinIoBucketname
 	// Check to see if we already own this bucket (which happens if you run this twice)
@@ -145,14 +146,16 @@ func UploadImgToMinIo(fileName, filePath string) (string, error) {
 		log.Printf("We already own %s\n", bucketName)
 	} else {
 		log.Fatalln(err)
+		return "2", err
 	}
-	path := utils.MinIoUpload_Audio_Dir + time.Now().Format("200601/20060102/")
+	path := utils.MinIoUploadDir + time.Now().Format("200601/20060102/")
 	path += fileName
 	// Upload the zip file with FPutObject
 	//contentType := "application/xlsx"
 	_, err = minioClient.FPutObject(ctx, bucketName, path, filePath, minio.PutObjectOptions{})
 	if err != nil {
 		log.Fatalln(err)
+		return "3", err
 	}
 
 	path = utils.MinIoImghost + path