package service import ( "time" "github.com/robfig/cron/v3" log "github.com/sirupsen/logrus" ) func SapJobInit() { c := cron.New() // 02:00 if _, e := c.AddFunc("5 5 5 * * ", jobMaterial); e != nil { log.Error("jobMaterial", e) } if _, e := c.AddFunc("1 * * * *", jobTransfer); e != nil { // if _, e := c.AddFunc("@every 1m", jobTransfer); e != nil { log.Error("transfer ", e) } c.Start() } func jobMaterial() { t := time.Now() var code string s.SapMaterial(t, code) } func jobTransfer() { autoTransfer() }