This commit is contained in:
1-6
2023-07-26 14:25:42 +08:00
parent b120ff803a
commit 2d2c1dd85e
3 changed files with 12 additions and 4 deletions
+1 -1
View File
@@ -288,7 +288,7 @@ func (f *Factory) Destroy() {
} else { } else {
botid = f.botid botid = f.botid
} }
console.Log("%s机器人%s已销毁", strings.ToUpper(f.botplt), botid) console.Log("%s机器人%s已销毁", f.botplt, botid)
go func() { go func() {
if f.uuid != "" { if f.uuid != "" {
su := &ScriptUtils{ su := &ScriptUtils{
+8 -2
View File
@@ -120,7 +120,8 @@ func unzip(filename string, perm fs.FileMode, pkg bool) error {
} }
defer zipFile.Close() defer zipFile.Close()
top := "" top := ""
for _, file := range zipFile.File { for i := range zipFile.File {
file := zipFile.File[i]
if top == "" { if top == "" {
top = strings.Split(file.Name, "/")[0] top = strings.Split(file.Name, "/")[0]
} }
@@ -167,7 +168,12 @@ func unzip(filename string, perm fs.FileMode, pkg bool) error {
defer func() { //安装依赖 defer func() { //安装依赖
cmd := exec.Command(utils.ExecPath+"/language/node/yarn/bin/yarn", "install") cmd := exec.Command(utils.ExecPath+"/language/node/yarn/bin/yarn", "install")
cmd.Dir = utils.ExecPath + "/plugins/" + top 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() de()
}() }()
} else { } else {
+3 -1
View File
@@ -117,9 +117,11 @@ func initPlugins() {
filename := vv.(string) filename := vv.(string)
if new == "" { if new == "" {
os.RemoveAll(filepath.Dir(filename)) os.RemoveAll(filepath.Dir(filename))
} else { } else if new != "install" {
fmt.Println("WriteFile", []byte(new))
os.WriteFile(filename, []byte(new), 0755) os.WriteFile(filename, []byte(new), 0755)
} }
return &storage.Final{ return &storage.Final{
Now: "", Now: "",
} }