task.go 789 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package services
  2. import (
  3. "fmt"
  4. "github.com/astaxie/beego/toolbox"
  5. )
  6. func Task() {
  7. fmt.Println("task start")
  8. //发送邮件
  9. sendEmail := toolbox.NewTask("sendEmail", "0 0 12 * * 0 ", SendEmail)
  10. toolbox.AddTask("sendEmail", sendEmail)
  11. oneMinute := toolbox.NewTask("oneMinute", "0 */1 * * * * ", OneMinute)
  12. toolbox.AddTask("oneMinute", oneMinute)
  13. //ImportCompanyUsers()
  14. toolbox.StartTask()
  15. fmt.Println("task end")
  16. }
  17. func SendEmail() (err error) {
  18. //报告历史访问次数
  19. go ReportViewTimes()
  20. //报告访问详情
  21. go ReportViewDetail()
  22. //潜在客户回访记录
  23. go FreeViewerDetail()
  24. //用户权限统计
  25. go HongzeUsers()
  26. return
  27. }
  28. func OneMinute() (err error) {
  29. //日度
  30. //FrequencyByDay()
  31. //周度
  32. FrequencyByWeek()
  33. //月度
  34. //FrequencyByMonth()
  35. return
  36. }