修改传输协议中的数据

This commit is contained in:
wangjian 2023-04-02 23:34:11 +08:00
parent d1c3e04298
commit 3556c6df3f
2 changed files with 7 additions and 3 deletions

View File

@ -2,6 +2,7 @@ package global
import ( import (
"crypto/md5" "crypto/md5"
"encoding/base64"
"encoding/hex" "encoding/hex"
"encoding/json" "encoding/json"
"fmt" "fmt"
@ -64,6 +65,8 @@ func InitWatchFolder(folderPath string) {
FileHistoryMap[path] = item FileHistoryMap[path] = item
FileList.Add(path) FileList.Add(path)
} }
} else {
_ = Watch.Add(fi.Name())
} }
return nil return nil
}) })
@ -186,7 +189,7 @@ func transferData(list *arraylist.List) {
FilePath: strings.Replace(FileHistoryMap[fileName].FilePath, Cfg.MonitorPath, "", -1), FilePath: strings.Replace(FileHistoryMap[fileName].FilePath, Cfg.MonitorPath, "", -1),
DatasetId: Cfg.DatasetId, DatasetId: Cfg.DatasetId,
FileSize: len(src), FileSize: len(src),
File: string(dstContent), File: base64.StdEncoding.EncodeToString(dstContent),
IsCompress: true, IsCompress: true,
FileMd5: FileHistoryMap[fileName].FileMd5, FileMd5: FileHistoryMap[fileName].FileMd5,
} }
@ -200,6 +203,7 @@ func transferData(list *arraylist.List) {
if err != nil { if err != nil {
Logger.With( Logger.With(
zap.String("文件名称", fileName), zap.String("文件名称", fileName),
zap.String("存储路径", item.FilePath),
).Error("文件传输", zap.Error(err)) ).Error("文件传输", zap.Error(err))
list.Add(fileName) list.Add(fileName)
} }

4
go.mod
View File

@ -13,11 +13,11 @@ require (
gopkg.in/yaml.v3 v3.0.1 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 ( require (
git.hpds.cc/Component/mq_coder v0.0.0-20221010064749-174ae7ae3340 // indirect 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/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
github.com/golang/mock v1.6.0 // indirect github.com/golang/mock v1.6.0 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect