From ea0cff094c11ffe6c16daf5faf4b4e02aa234412 Mon Sep 17 00:00:00 2001
From: dsmzx <dsmzx@123.com>
Date: 星期二, 25 六月 2024 13:53:36 +0800
Subject: [PATCH] 出库/入库 打印 fileTemplateAttachment中添加仓库id和const中添加两个模板属性
---
utils/upload/seaweed.go | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/utils/upload/seaweed.go b/utils/upload/seaweed.go
index 931df16..5f10ab5 100644
--- a/utils/upload/seaweed.go
+++ b/utils/upload/seaweed.go
@@ -1,17 +1,15 @@
package upload
import (
- "basic.com/fileserver/WeedFSClient.git"
- uuid "github.com/satori/go.uuid"
- "strconv"
"time"
"wms/conf"
"wms/pkg/logx"
+ "wms/pkg/weedfs"
)
-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=" + strconv.FormatInt(time.Now().Unix(), 10) + "-" + conf.WebConf.ServerId + "-" + fileType
+ assignUrl := conf.WebConf.FileServer + "/dir/assign?collection=12345-" + conf.WebConf.ServerId + "-" + fileType
picUrl, err := WeedFSClient.GetFid(assignUrl)
if err != nil {
@@ -19,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
}
--
Gitblit v1.8.0