mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-13 21:57:29 +08:00
cron web api: support kind=cron with expr for create/update
This commit is contained in:
@@ -245,6 +245,13 @@ func gatewayCmd() {
|
||||
at := int64(atMS)
|
||||
schedule.AtMS = &at
|
||||
}
|
||||
if kind == "cron" {
|
||||
expr := getStr("expr")
|
||||
if expr == "" {
|
||||
return nil, fmt.Errorf("expr required for kind=cron")
|
||||
}
|
||||
schedule.Expr = expr
|
||||
}
|
||||
deliver := false
|
||||
if v, ok := args["deliver"].(bool); ok {
|
||||
deliver = v
|
||||
@@ -288,6 +295,13 @@ func gatewayCmd() {
|
||||
s.AtMS = &at
|
||||
}
|
||||
}
|
||||
if kind == "cron" {
|
||||
expr := getStr("expr")
|
||||
if expr == "" {
|
||||
return nil, fmt.Errorf("expr required for kind=cron")
|
||||
}
|
||||
s.Expr = expr
|
||||
}
|
||||
in.Schedule = &s
|
||||
}
|
||||
return cronService.UpdateJob(id, in)
|
||||
|
||||
Reference in New Issue
Block a user