From 41b3382dad7c7a977ba2e55c56d307b5af519d00 Mon Sep 17 00:00:00 2001 From: xc Date: Tue, 16 Sep 2025 18:04:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E7=AB=AFRPC=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aufs/core/sendzip.go | 13 ++++++++++++- scagent/core/FileRpc.go | 8 +++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/aufs/core/sendzip.go b/aufs/core/sendzip.go index d88bfcc..49c44a7 100644 --- a/aufs/core/sendzip.go +++ b/aufs/core/sendzip.go @@ -12,9 +12,20 @@ import ( "time" ) -// 将文件打包成压缩包 +// 远程调用压缩包 func SendZip(w http.ResponseWriter, r *http.Request) { r.ParseForm() + + // 文件 + zipfarr := r.Form["sfiles"] + + // 服务器ip地址 + serip := r.Form["serverip"] +} + +// 将文件打包成压缩包 +func SendZip00(w http.ResponseWriter, r *http.Request) { + r.ParseForm() // 选择文件,并生成zip包 // 文件 zipfarr := r.Form["sfiles"] diff --git a/scagent/core/FileRpc.go b/scagent/core/FileRpc.go index ef40086..3f1fd41 100644 --- a/scagent/core/FileRpc.go +++ b/scagent/core/FileRpc.go @@ -9,6 +9,8 @@ import ( "scagent/util" "strings" "time" + + "go.uber.org/zap" ) // FileService 提供文件传输服务 @@ -54,6 +56,9 @@ func (f *FileService) Upload(chunk FileChunk, reply *bool) error { // 压缩文件 // 返回压缩包的名称 func (f *FileService) Compress(args *ZipBlock, reply *string) error { + // 启用日志 + logger := util.NewProductionLogger() + defer logger.Sync() // 实际路径 realFilePath := filepath.Join(config.G.FilePath, args.Curpath) // zip 文件名 @@ -64,7 +69,8 @@ func (f *FileService) Compress(args *ZipBlock, reply *string) error { go func() { util.CompressToZip(zpFileName, realFilePath, args.SelFile) taskId <- "arcok" - // fmt.Fprintln(w, "create archive:", err) + // 日志输出 + logger.Info("压缩文件", zap.String("filename", zpFileName), zap.String("path", realFilePath)) }() // ZIP 文件的实际路径 ziprl := path.Join("./sync_zips/", zpFileName)