zhangqian
2023-12-27 62cc4765bdb6e7084897fefd91b6c25a64dd4d72
utils/upload/seaweed.go
@@ -2,13 +2,12 @@
import (
   "basic.com/fileserver/WeedFSClient.git"
   uuid "github.com/satori/go.uuid"
   "time"
   "wms/conf"
   "wms/pkg/logx"
)
func UploadFileToSeaWeed(fileType, ext string, fileBytes []byte) (string, error) {
func UploadFileToSeaWeed(fileType, fileName string, fileBytes []byte) (string, error) {
   //assignUrl := conf.WebConf.FileServer + "/dir/assign?collection=" + time.Now().Format("2006-01-02 15:04:05")[:10] + "-" + conf.WebConf.ServerId + "-" + fileType
   assignUrl := conf.WebConf.FileServer + "/dir/assign?collection=12345-" + conf.WebConf.ServerId + "-" + fileType
@@ -18,7 +17,7 @@
      return picUrl, err
   }
   picFileName := uuid.NewV4().String() + "." + ext
   go WeedFSClient.UploadFile(picUrl, picFileName, fileBytes, 3*time.Second)
   //picFileName := uuid.NewV4().String() + "." + ext
   go WeedFSClient.UploadFile(picUrl, fileName, fileBytes, 3*time.Second)
   return picUrl, nil
}