micro-bundle/pkg/cron/cron.go
2025-10-13 14:15:37 +08:00

26 lines
340 B
Go

package cron
import (
"log"
"micro-bundle/internal/logic"
"github.com/robfig/cron/v3"
)
func InitCronJob() {
c := cron.New(cron.WithSeconds())
spec := "0 0 0 1 * *"
_, err := c.AddFunc(spec, func() {
log.Printf("执行余量每月数据更新")
logic.UpdateBundleBalance()
})
if err != nil {
panic(err)
}
c.Start()
}