task.go 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 7-23 * * * ", OneMinute)
  12. toolbox.AddTask("oneMinute", oneMinute)
  13. //隆众指标获取
  14. getLzProductList := toolbox.NewTask("getLzProductList", "0 0 11-19/1 * * * ", GetLzProductList)
  15. toolbox.AddTask("getLzProductList", getLzProductList)
  16. //隆众指标数据获取
  17. getLzProductDetail := toolbox.NewTask("getLzProductDetail", "0 5 11-19/1 * * * ", GetLzProductDetail)
  18. toolbox.AddTask("getLzProductDetail", getLzProductDetail)
  19. //隆众价格指标获取
  20. getLzProductPriceProduct := toolbox.NewTask("getLzProductPriceProduct", "0 5 11-19/1 * * * ", GetLzProductPriceProduct)
  21. toolbox.AddTask("getLzProductPriceProduct", getLzProductPriceProduct)
  22. //隆众价格指标数据获取
  23. getLzProductPriceData := toolbox.NewTask("getLzProductPriceData", "0 10 11-19/1 * * * ", GetLzProductPriceData)
  24. toolbox.AddTask("getLzProductPriceData", getLzProductPriceData)
  25. //正式->试用
  26. companyTryOut := toolbox.NewTask("companyTryOut", "0 5 0 * * *", CompanyTryOut)
  27. toolbox.AddTask("companyTryOut", companyTryOut)
  28. //试用->冻结
  29. companyFreeze := toolbox.NewTask("companyFreeze", "0 10 0 * * *", CompanyFreeze)
  30. toolbox.AddTask("companyFreeze", companyFreeze)
  31. //冻结->流失
  32. companyLoss := toolbox.NewTask("companyLoss", "0 20 0 * * *", CompanyLoss)
  33. toolbox.AddTask("companyLoss", companyLoss)
  34. //删除日志记录
  35. deleteReportSaveLog := toolbox.NewTask("deleteReportSaveLog", "0 20 0 * * *", DeleteReportSaveLog)
  36. toolbox.AddTask("deleteReportSaveLog", deleteReportSaveLog)
  37. toolbox.StartTask()
  38. //GetHistoryLzProductDetail()
  39. //GetLzPrice()
  40. //GetLzProductDetail()
  41. //LzExportExcel()
  42. //GetLzProductList()GetLzProductDetail
  43. fmt.Println("task end")
  44. }
  45. func Task123() {
  46. fmt.Println("start")
  47. //0 42 4 1 * *     毎月1日的 4:42 分 执行
  48. DeleteReportSaveLog()
  49. fmt.Println("end")
  50. }
  51. func SendEmail() (err error) {
  52. //报告历史访问次数
  53. go ReportViewTimes()
  54. //报告访问详情
  55. go ReportViewDetail()
  56. //潜在客户回访记录
  57. go FreeViewerDetail()
  58. //用户权限统计
  59. go HongzeUsers()
  60. return
  61. }
  62. func OneMinute() (err error) {
  63. //日度
  64. //FrequencyByDay()
  65. //周度
  66. FrequencyByWeek()
  67. //月度
  68. //FrequencyByMonth()
  69. return
  70. }