From 2d2c1dd85ee58460b3fd85a3b4ed0914b18e7f53 Mon Sep 17 00:00:00 2001 From: 1-6 Date: Wed, 26 Jul 2023 14:25:42 +0800 Subject: [PATCH] x --- core/adapter.go | 2 +- core/grpc_asset.go | 10 ++++++++-- core/plugin_core.go | 4 +++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/core/adapter.go b/core/adapter.go index c3eabab..853a86a 100644 --- a/core/adapter.go +++ b/core/adapter.go @@ -288,7 +288,7 @@ func (f *Factory) Destroy() { } else { botid = f.botid } - console.Log("%s机器人%s已销毁", strings.ToUpper(f.botplt), botid) + console.Log("%s机器人%s已销毁", f.botplt, botid) go func() { if f.uuid != "" { su := &ScriptUtils{ diff --git a/core/grpc_asset.go b/core/grpc_asset.go index d5ea337..6450572 100644 --- a/core/grpc_asset.go +++ b/core/grpc_asset.go @@ -120,7 +120,8 @@ func unzip(filename string, perm fs.FileMode, pkg bool) error { } defer zipFile.Close() top := "" - for _, file := range zipFile.File { + for i := range zipFile.File { + file := zipFile.File[i] if top == "" { top = strings.Split(file.Name, "/")[0] } @@ -167,7 +168,12 @@ func unzip(filename string, perm fs.FileMode, pkg bool) error { defer func() { //安装依赖 cmd := exec.Command(utils.ExecPath+"/language/node/yarn/bin/yarn", "install") cmd.Dir = utils.ExecPath + "/plugins/" + top - console.Log(cmd.Output()) + data, err := cmd.Output() + if err != nil { + console.Error("依赖添加失败:", err) + } else { + console.Log(string(data)) + } de() }() } else { diff --git a/core/plugin_core.go b/core/plugin_core.go index 712a50d..d3a3f27 100644 --- a/core/plugin_core.go +++ b/core/plugin_core.go @@ -117,9 +117,11 @@ func initPlugins() { filename := vv.(string) if new == "" { os.RemoveAll(filepath.Dir(filename)) - } else { + } else if new != "install" { + fmt.Println("WriteFile", []byte(new)) os.WriteFile(filename, []byte(new), 0755) } + return &storage.Final{ Now: "", }