JM-WechatMini/task/task.go

19 lines
336 B
Go
Raw Normal View History

2024-03-21 21:08:45 +08:00
package task
import (
"github.com/go-co-op/gocron"
"time"
)
var WxTask *gocron.Scheduler
func InitTask() {
WxTask = gocron.NewScheduler(time.Local)
// 每天凌晨1点执行
_, _ = WxTask.Every(1).Day().At("01:00").Do(CheckUserSurgeryDate) // 检查用户是否已到手术日期
// 开启定时任务
WxTask.StartAsync()
}