From 443bea10477318e87654287a6f8f7fd3dc758528 Mon Sep 17 00:00:00 2001 From: xc Date: Tue, 2 Sep 2025 14:29:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=BF=94=E5=9B=9E=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scagent/core/JsonRpc.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scagent/core/JsonRpc.go b/scagent/core/JsonRpc.go index bce2cbb..f860bdb 100644 --- a/scagent/core/JsonRpc.go +++ b/scagent/core/JsonRpc.go @@ -35,7 +35,7 @@ type FlpList struct { } // 获取文件路径 -func (f *FileRpcService) GetFilePath(args *Args, replay *Reply) error { +func (f *FileRpcService) GetFilePath(args *Args, replay *string) error { rootDir := args.FilePath logger := util.NewProductionLogger() defer logger.Sync() @@ -79,8 +79,15 @@ func (f *FileRpcService) GetFilePath(args *Args, replay *Reply) error { return err } // fmt.Printf("jsonStr: %s\n", jsonStr) - replay.Redata = string(jsonStr) + *replay = string(jsonStr) // return nil } + +func (f *FileRpcService) GetFileHash(args *Args, replay *Reply) error { + // 计算文件hash + hash := util.CalacHash(args.FilePath) + replay.Redata = hash + return nil +}