go-wxhelper/internal/tasks/tasks.go
2024-01-19 12:06:30 +08:00

21 lines
351 B
Go

package tasks
import (
"github.com/go-co-op/gocron"
"log"
"time"
)
var Scheduler *gocron.Scheduler
// StartScheduled
// @description: 启动定时任务
func StartScheduled() {
// 定时任务发送消息
Scheduler = gocron.NewScheduler(time.Local)
// 开启定时任务
Scheduler.StartAsync()
log.Println("定时任务初始化成功")
}