task.go 416 B

1234567891011121314151617181920
  1. package services
  2. import (
  3. "fmt"
  4. "github.com/beego/beego/v2/task"
  5. )
  6. var blackMobile map[string]string
  7. func Task() {
  8. fmt.Println("task start")
  9. //检测未推送短信信息
  10. checkSmsSend := task.NewTask("checkSmsSend", "0 0 */1 * * *", CheckSmsSend)
  11. task.AddTask("checkSmsSend", checkSmsSend)
  12. task.StartTask()
  13. blackMobile = make(map[string]string)
  14. blackMobile["10010"] = "10010"
  15. fmt.Println("task end")
  16. }