task_gn.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. // 每分钟检查一下是否需要发送报告撰写提醒
  29. sendReportWriteRemind := task.NewTask("sendReportWriteRemind", "0 */1 * * * *", ReportWriteRemind)
  30. task.AddTask("定时发送报告撰写提醒", sendReportWriteRemind)
  31. }