task.go 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. companyRemind := toolbox.NewTask("companyRemind", "0 30 08 * * *", CompanyRemind)
  36. toolbox.AddTask("companyRemind", companyRemind)
  37. //删除日志记录
  38. //deleteReportSaveLog := toolbox.NewTask("deleteReportSaveLog", "0 30 08 * * *", DeleteReportSaveLog)
  39. //toolbox.AddTask("deleteReportSaveLog", deleteReportSaveLog)
  40. toolbox.StartTask()
  41. //GetHistoryLzProductDetail()
  42. //GetLzPrice()
  43. //GetLzProductDetail()
  44. //LzExportExcel()
  45. //GetLzProductList()GetLzProductDetail
  46. fmt.Println("task end")
  47. }
  48. func Task123() {
  49. fmt.Println("start")
  50. CompanyRemind()
  51. fmt.Println("end")
  52. }
  53. func SendEmail() (err error) {
  54. //报告历史访问次数
  55. go ReportViewTimes()
  56. //报告访问详情
  57. go ReportViewDetail()
  58. //潜在客户回访记录
  59. go FreeViewerDetail()
  60. //用户权限统计
  61. go HongzeUsers()
  62. return
  63. }
  64. func OneMinute() (err error) {
  65. //日度
  66. //FrequencyByDay()
  67. //周度
  68. FrequencyByWeek()
  69. //月度
  70. //FrequencyByMonth()
  71. return
  72. }