19 lines
336 B
Go
19 lines
336 B
Go
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()
|
|
}
|