task.go 780 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package services
  2. import (
  3. "context"
  4. "fmt"
  5. )
  6. func Task() {
  7. fmt.Println("start crawler")
  8. //refreshData := task.NewTask("refreshData", "0 0,30 16-20 * * *", RefreshData)
  9. //refreshEic := task.NewTask("refreshData", "0 0 1,6 * * *", RefreshEic)
  10. //task.AddTask("数据爬取", refreshData)
  11. //task.AddTask("欧洲天然气爬取", refreshEic)
  12. //task.StartTask()
  13. FileCoalJsm()
  14. FileCoalFirm()
  15. FileCoalCoastal()
  16. FileCoalInland()
  17. fmt.Println("end crawler")
  18. }
  19. func RefreshData(cont context.Context) (err error) {
  20. //大连
  21. SyncRankingFromDalianSearch(0)
  22. SyncRankingFromZhengzhou()
  23. SyncRankingFromShangHai()
  24. SyncRankingFromIne()
  25. SyncRankingFromCffex()
  26. //SyncStorageFromEic()
  27. return
  28. }
  29. func RefreshEic(cont context.Context) (err error) {
  30. SyncStorageFromEic()
  31. return
  32. }