task_gn.go 546 B

123456789101112131415161718192021222324252627
  1. package services
  2. import (
  3. "eta_gn/eta_task/services/eta_bridge"
  4. "eta_gn/eta_task/utils"
  5. "fmt"
  6. "github.com/beego/beego/v2/task"
  7. )
  8. func GnTask() {
  9. // 初始化一次
  10. fmt.Println(eta_bridge.SyncGnIndex(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. }