🎉 first commit
This commit is contained in:
24
tasks/tasks.go
Normal file
24
tasks/tasks.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package tasks
|
||||
|
||||
import (
|
||||
"github.com/go-co-op/gocron"
|
||||
"log"
|
||||
"time"
|
||||
)
|
||||
|
||||
// InitTasks
|
||||
// @description: 初始化定时任务
|
||||
func InitTasks() {
|
||||
// 定时任务发送消息
|
||||
s := gocron.NewScheduler(time.Local)
|
||||
|
||||
// 每天早上九点半发送前一天的水群排行
|
||||
_, _ = s.Every(1).Day().At("09:30").Do(yesterday)
|
||||
|
||||
// 每小时更新一次好友列表
|
||||
_, _ = s.Every(1).Minute().Do(syncFriends)
|
||||
|
||||
// 开启定时任务
|
||||
s.StartAsync()
|
||||
log.Println("定时任务初始化成功")
|
||||
}
|
||||
Reference in New Issue
Block a user