From b0113676f423ca930bc3dd93ac9d9ea292458dfa Mon Sep 17 00:00:00 2001
From: jiangshuai <291802688@qq.com>
Date: 星期四, 23 十一月 2023 11:28:56 +0800
Subject: [PATCH] 1.修改MoveHistory字段类型 2.完成MoveHistory插入数据 3.operation增加审批时间、收货人、收货地址、联系电话字段,并修改相应接口以及打印

---
 utils/upload/seaweed.go |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/utils/upload/seaweed.go b/utils/upload/seaweed.go
index acc30e6..931df16 100644
--- a/utils/upload/seaweed.go
+++ b/utils/upload/seaweed.go
@@ -1 +1,25 @@
 package upload
+
+import (
+	"basic.com/fileserver/WeedFSClient.git"
+	uuid "github.com/satori/go.uuid"
+	"strconv"
+	"time"
+	"wms/conf"
+	"wms/pkg/logx"
+)
+
+func UploadFileToSeaWeed(fileType, ext 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
+
+	picUrl, err := WeedFSClient.GetFid(assignUrl)
+	if err != nil {
+		logx.Error(err.Error())
+		return picUrl, err
+	}
+
+	picFileName := uuid.NewV4().String() + "." + ext
+	go WeedFSClient.UploadFile(picUrl, picFileName, fileBytes, 3*time.Second)
+	return picUrl, nil
+}

--
Gitblit v1.8.0