package services import ( "context" "fmt" "github.com/beego/beego/v2/task" ) func Task() { fmt.Println("task start") //SyncYesterdayLogs(nil) // 每日同步接口日志 syncYesterdayLogs := task.NewTask("SyncYesterdayLogs", "0 0 4 * * * ", SyncYesterdayLogs) task.AddTask("每日同步接口日志", syncYesterdayLogs) // 每日同步查研观向接口日志 syncYesterdayLogsByCygx := task.NewTask("SyncYesterdayLogsByCygx", "0 30 4 * * * ", SyncYesterdayLogsByCygx) task.AddTask("每日同步查研观向接口日志", syncYesterdayLogsByCygx) task.StartTask() cxt := new(context.Context) SyncYesterdayLogsByCygx(*cxt) fmt.Println("task end") }