You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
336 B
Go
19 lines
336 B
Go
6 months ago
|
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()
|
||
|
}
|