task_gn.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package services
  2. import (
  3. "eta_gn/eta_task/services/eta_bridge"
  4. "eta_gn/eta_task/utils"
  5. "github.com/beego/beego/v2/task"
  6. )
  7. func GnTask() {
  8. // 初始化一次
  9. //fmt.Println(eta_bridge.SyncGnIndex(nil))
  10. //fmt.Println(eta_bridge.InitRefreshEdb(nil))
  11. // 指标相关
  12. // 每小时同步一次指标列表
  13. if utils.SyncIndexPath != `` {
  14. syncIndexTime := utils.SyncIndexTime
  15. if syncIndexTime == `` {
  16. syncIndexTime = "0 0 * * * *"
  17. }
  18. syncIndex := task.NewTask("syncIndex", syncIndexTime, eta_bridge.SyncGnIndex)
  19. task.AddTask("定时同步指标信息", syncIndex)
  20. }
  21. //// 每小时同步一次OA用户信息
  22. //syncOaUserTime := utils.SyncOaUserTime
  23. //if syncOaUserTime == `` {
  24. // syncOaUserTime = "0 0 * * * *"
  25. //}
  26. //syncOaUser := task.NewTask("syncGnUser", syncOaUserTime, eta_bridge.SyncGnUser)
  27. //task.AddTask("定时同步OA用户信息", syncOaUser)
  28. // 每天6点,12点,18点,半点开始每10分钟同步一次
  29. syncDataNodeTime := utils.SyncDataNodeTime
  30. if syncDataNodeTime == `` {
  31. syncDataNodeTime = "0 30/10 6,12,18 * * *"
  32. }
  33. syncDataNode := task.NewTask("syncDataNode", syncDataNodeTime, eta_bridge.SyncDataNode)
  34. task.AddTask("定时同步数据节点观点数据", syncDataNode)
  35. // 每分钟检查一下是否需要发送报告撰写提醒
  36. sendReportWriteRemind := task.NewTask("sendReportWriteRemind", "0 */1 * * * *", ReportWriteRemind)
  37. task.AddTask("定时发送报告撰写提醒", sendReportWriteRemind)
  38. }