From 4e0acfc76d41fdeb7027f289130e94265adac445 Mon Sep 17 00:00:00 2001 From: cdle <798731886@qq.com> Date: Thu, 28 Oct 2021 19:26:11 +0800 Subject: [PATCH] update --- core/otto.go | 11 +++++++++++ develop/qinglong/task.go | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/core/otto.go b/core/otto.go index 0fae034..602c665 100644 --- a/core/otto.go +++ b/core/otto.go @@ -1,7 +1,9 @@ package core import ( + "crypto/md5" "fmt" + "io" "io/ioutil" "os" "regexp" @@ -29,6 +31,15 @@ var OttoFuncs = map[string]func(string) string{ data, _ := os.ReadFile("/var/lib/dbus/machine-id") return regexp.MustCompile(`\w+`).FindString(string(data)) }, + "uuid": func(_ string) string { + return GetUUID() + }, + "md5": func(str string) string { + w := md5.New() + io.WriteString(w, str) + md5str := fmt.Sprintf("%x", w.Sum(nil)) + return md5str + }, } func init123() { diff --git a/develop/qinglong/task.go b/develop/qinglong/task.go index 0597a6e..71ec896 100644 --- a/develop/qinglong/task.go +++ b/develop/qinglong/task.go @@ -71,7 +71,7 @@ func init() { cron := &Carrier{ Get: "data._id", } - if err := Config.Req(cron, CRONS, POST, []byte(`{"name":"sillyGirl临时创建任务","command":"task `+s.Get()+`","schedule":" 1 1 1 1 1"}`)); err != nil { + if err := Config.Req(cron, CRONS, POST, []byte(`{"name":"sillyGirl临时创建任务","command":"repo `+s.Get()+`","schedule":" 1 1 1 1 1"}`)); err != nil { return err } if err := Config.Req(CRONS, PUT, "/run", []byte(fmt.Sprintf(`["%s"]`, cron.Value))); err != nil {