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