task.go 2.6 KB

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