update
This commit is contained in:
@@ -81,7 +81,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Req(CRONS, PUT, "/run", []byte(fmt.Sprintf(`["%s"]`, cron.ID))); err != nil {
|
||||
if err := Config.Req(CRONS, PUT, "/run", []byte(fmt.Sprintf(`["%s"]`, cron.ID))); err != nil {
|
||||
return err
|
||||
}
|
||||
return fmt.Sprintf("已运行 %v", cron.Name)
|
||||
@@ -95,7 +95,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Req(CRONS, PUT, "/stop", []byte(fmt.Sprintf(`["%s"]`, cron.ID))); err != nil {
|
||||
if err := Config.Req(CRONS, PUT, "/stop", []byte(fmt.Sprintf(`["%s"]`, cron.ID))); err != nil {
|
||||
return err
|
||||
}
|
||||
return "操作成功"
|
||||
@@ -109,7 +109,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Req(CRONS, PUT, "/enable", []byte(fmt.Sprintf(`["%s"]`, cron.ID))); err != nil {
|
||||
if err := Config.Req(CRONS, PUT, "/enable", []byte(fmt.Sprintf(`["%s"]`, cron.ID))); err != nil {
|
||||
return err
|
||||
}
|
||||
return "操作成功"
|
||||
@@ -123,7 +123,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Req(CRONS, PUT, "/disable", []byte(fmt.Sprintf(`["%s"]`, cron.ID))); err != nil {
|
||||
if err := Config.Req(CRONS, PUT, "/disable", []byte(fmt.Sprintf(`["%s"]`, cron.ID))); err != nil {
|
||||
return err
|
||||
}
|
||||
return "操作成功"
|
||||
@@ -173,7 +173,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Req(CRONS, PUT, "/run", []byte(fmt.Sprintf(`["%s"]`, cron.ID))); err != nil {
|
||||
if err := Config.Req(CRONS, PUT, "/run", []byte(fmt.Sprintf(`["%s"]`, cron.ID))); err != nil {
|
||||
return err
|
||||
}
|
||||
return "操作成功"
|
||||
@@ -230,7 +230,7 @@ func init() {
|
||||
continue
|
||||
}
|
||||
if strings.Contains(crons[i].Command, "jd_disable.py") {
|
||||
Req(CRONS, PUT, "/disable", []byte(fmt.Sprintf(`["%s"]`, crons[i].ID)))
|
||||
Config.Req(CRONS, PUT, "/disable", []byte(fmt.Sprintf(`["%s"]`, crons[i].ID)))
|
||||
continue
|
||||
}
|
||||
if task, ok := tasks[crons[i].Name]; ok {
|
||||
@@ -241,7 +241,7 @@ func init() {
|
||||
dup = task
|
||||
tasks[crons[i].Name] = crons[i]
|
||||
}
|
||||
if err := Req(CRONS, PUT, "/disable", []byte(fmt.Sprintf(`["%s"]`, dup.ID))); err != nil {
|
||||
if err := Config.Req(CRONS, PUT, "/disable", []byte(fmt.Sprintf(`["%s"]`, dup.ID))); err != nil {
|
||||
s.Reply(fmt.Sprintf("隐藏 %v %v %v", dup.Name, dup.Command, err))
|
||||
} else {
|
||||
s.Reply(fmt.Sprintf("已隐藏重复任务 %v %v", dup.Name, dup.Command), core.N)
|
||||
@@ -258,7 +258,7 @@ func init() {
|
||||
|
||||
func GetCrons(searchValue string) ([]Cron, error) {
|
||||
er := CronResponse{}
|
||||
if err := Req(CRONS, &er, "?searchValue="+searchValue); err != nil {
|
||||
if err := Config.Req(CRONS, &er, "?searchValue="+searchValue); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return er.Data, nil
|
||||
@@ -268,7 +268,7 @@ func GetCronLog(id string) (string, error) {
|
||||
c := &Carrier{
|
||||
Get: "data",
|
||||
}
|
||||
if err := Req(CRONS, "/"+id+"/log", c); err != nil {
|
||||
if err := Config.Req(CRONS, "/"+id+"/log", c); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return c.Value, nil
|
||||
|
||||
Reference in New Issue
Block a user