From 3556c6df3f13aed6ca89441b043b6c0a06e24056 Mon Sep 17 00:00:00 2001 From: wangjian Date: Sun, 2 Apr 2023 23:34:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BC=A0=E8=BE=93=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE=E4=B8=AD=E7=9A=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- global/global.go | 6 +++++- go.mod | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/global/global.go b/global/global.go index 31a2883..379262f 100644 --- a/global/global.go +++ b/global/global.go @@ -2,6 +2,7 @@ package global import ( "crypto/md5" + "encoding/base64" "encoding/hex" "encoding/json" "fmt" @@ -64,6 +65,8 @@ func InitWatchFolder(folderPath string) { FileHistoryMap[path] = item FileList.Add(path) } + } else { + _ = Watch.Add(fi.Name()) } return nil }) @@ -186,7 +189,7 @@ func transferData(list *arraylist.List) { FilePath: strings.Replace(FileHistoryMap[fileName].FilePath, Cfg.MonitorPath, "", -1), DatasetId: Cfg.DatasetId, FileSize: len(src), - File: string(dstContent), + File: base64.StdEncoding.EncodeToString(dstContent), IsCompress: true, FileMd5: FileHistoryMap[fileName].FileMd5, } @@ -200,6 +203,7 @@ func transferData(list *arraylist.List) { if err != nil { Logger.With( zap.String("文件名称", fileName), + zap.String("存储路径", item.FilePath), ).Error("文件传输", zap.Error(err)) list.Add(fileName) } diff --git a/go.mod b/go.mod index 1a1ade9..35f82d5 100644 --- a/go.mod +++ b/go.mod @@ -13,11 +13,11 @@ require ( gopkg.in/yaml.v3 v3.0.1 ) -require git.hpds.cc/pavement/hpds_node v0.0.0-20230326152949-a1c0ad2f7052 +require git.hpds.cc/pavement/hpds_node v0.0.0-20230402152619-41414aafa930 require ( git.hpds.cc/Component/mq_coder v0.0.0-20221010064749-174ae7ae3340 // indirect - git.hpds.cc/Component/network v0.0.0-20230326151855-3c157f531d86 // indirect + git.hpds.cc/Component/network v0.0.0-20230402152327-d10a80765e7c // indirect github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect github.com/golang/mock v1.6.0 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect