|
@@ -4,6 +4,7 @@ import (
|
|
"context"
|
|
"context"
|
|
"encoding/json"
|
|
"encoding/json"
|
|
"github.com/gogf/gf/container/gmap"
|
|
"github.com/gogf/gf/container/gmap"
|
|
|
|
+ "github.com/gogf/gf/encoding/gjson"
|
|
"github.com/gogf/gf/v2/os/gcron"
|
|
"github.com/gogf/gf/v2/os/gcron"
|
|
"sparrow/pkg/rule"
|
|
"sparrow/pkg/rule"
|
|
"sparrow/pkg/server"
|
|
"sparrow/pkg/server"
|
|
@@ -30,6 +31,8 @@ func (t *TaskSchedule) AddTask(msg []byte) error {
|
|
if t.tasks.Contains(task.TaskId) {
|
|
if t.tasks.Contains(task.TaskId) {
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
+ newJson := gjson.New(task.Actions)
|
|
|
|
+ server.Log.Debugf("add task: taskId:%s,corn:%s,actions:%s", task.TaskId, task.Cron, newJson.MustToJsonString())
|
|
// 创建任务
|
|
// 创建任务
|
|
entity, err := gcron.Add(context.Background(), task.Cron, func(ctx context.Context) {
|
|
entity, err := gcron.Add(context.Background(), task.Cron, func(ctx context.Context) {
|
|
if err = NewTaskExecutor(task.Actions).Do(); err != nil {
|
|
if err = NewTaskExecutor(task.Actions).Do(); err != nil {
|