123456789101112131415161718192021222324252627282930 |
- 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("00 00 02 * * *", jobMaterial); e != nil {
- // log.Error("jobMaterial", e)
- // }
- if _, e := c.AddFunc("30 0/1 6-23 * * ? ", jobTransfer); e != nil {
- log.Error("transfer", e)
- }
- c.Start()
- }
- func jobMaterial() {
- t := time.Now()
- var code string
- s.SapMaterial(t, code)
- }
- func jobTransfer() {
- autoTransfer()
- }
|