init.go 592 B

1234567891011121314151617
  1. package timedTask
  2. import (
  3. "context"
  4. "github.com/gogf/gf/v2/frame/g"
  5. "github.com/robfig/cron"
  6. )
  7. func AutoReturnTask() {
  8. cr := cron.New()
  9. //go AutomaticPayment() //首次执行
  10. go OnlineReturnMoney() //首次执行
  11. //cr.AddFunc(g.Cfg().MustGet(context.Background(), "autoReturnTaskTime", "0 */3 * * * ?").String(), AutomaticPayment)
  12. cr.AddFunc(g.Cfg().MustGet(context.Background(), "onlineReturnMoney", "0 */2 * * * ?").String(), OnlineReturnMoney)
  13. cr.AddFunc(g.Cfg().MustGet(context.Background(), "protocolNotice.cron", "# 0 2 * * *").String(), OrderProtocolNotice)
  14. cr.Start()
  15. }