task_xy.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package services
  2. import (
  3. "eta/eta_task/services/eta_bridge"
  4. "eta/eta_task/utils"
  5. "github.com/beego/beego/v2/task"
  6. )
  7. func XyTask() {
  8. if utils.IsXy != "1" {
  9. return
  10. }
  11. //eta_bridge.SyncIndexList(nil)
  12. //eta_bridge.SyncIndexValueList(nil)
  13. //eta_bridge.SyncClassifyList(nil)
  14. //eta_bridge.SyncEdbClassifyList(nil)
  15. //eta_bridge.SyncIndex(nil)
  16. //return
  17. // 用户信息
  18. if utils.SyncUserPath != `` {
  19. syncUserTime := utils.SyncUserTime
  20. if syncUserTime == `` {
  21. syncUserTime = "0 0 * * * *"
  22. }
  23. // 每小时同步一次用户列表
  24. syncUser := task.NewTask("syncUser", syncUserTime, eta_bridge.SyncUser)
  25. task.AddTask("定时同步用户账号", syncUser)
  26. }
  27. // 指标相关
  28. if utils.SyncIndexPath != `` {
  29. // 每天同步一次指标与分类关系的列表
  30. syncIndexClassifyTime := utils.SyncIndexClassifyTime
  31. if syncIndexClassifyTime == `` {
  32. syncIndexClassifyTime = "0 0 0 * * *"
  33. }
  34. syncIndexClassify := task.NewTask("syncIndexClassify", syncIndexClassifyTime, eta_bridge.SyncClassifyList)
  35. task.AddTask("定时同步指标与分类关系", syncIndexClassify)
  36. // 每小时同步一次指标列表
  37. syncIndexTime := utils.SyncIndexTime
  38. if syncIndexTime == `` {
  39. syncIndexTime = "0 0 * * * *"
  40. }
  41. syncIndex := task.NewTask("syncIndex", syncIndexTime, eta_bridge.SyncIndex)
  42. task.AddTask("定时同步指标信息", syncIndex)
  43. }
  44. if utils.SyncCrmIndexPath != `` {
  45. // 每小时同步一次指标列表
  46. syncIndexTime := utils.SyncCrmIndexTime
  47. if syncIndexTime == `` {
  48. syncIndexTime = "0 0 * * * *"
  49. }
  50. syncXyCrmIndex := task.NewTask("syncXyCrmIndex", syncIndexTime, eta_bridge.SyncXyCrmIndex)
  51. task.AddTask("定时同步crm指标信息", syncXyCrmIndex)
  52. }
  53. }