main.go 921 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package main
  2. import (
  3. u "data_tidb/util"
  4. "github.com/robfig/cron"
  5. "strconv"
  6. "time"
  7. )
  8. func init() {
  9. u.InitInfo() //初始化...
  10. //u.InitSaveService()//批量保存...
  11. }
  12. func main() {
  13. //标讯信息 655ff28faf7d908a8c546ec3
  14. //bidding.TaskBidding("100000000000000000000000", "655ff28faf7d908a8c546ec3")
  15. //定时增量...
  16. cr := cron.New()
  17. cr.AddFunc("0 0 9 ? * *", func() {
  18. if gteid, ltid := getCurTimePiInfo(); gteid != "" && ltid != "" {
  19. //bidding.TaskBidding(gteid, ltid)
  20. }
  21. })
  22. cr.Start()
  23. ch := make(chan bool, 1)
  24. <-ch
  25. }
  26. func getCurTimePiInfo() (string, string) {
  27. now := time.Now()
  28. start := time.Date(now.Year(), now.Month(), now.Day()-1, 0, 0, 0, 0, time.Local).Unix()
  29. end := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).Unix()
  30. gteid := strconv.FormatInt(start, 16) + "0000000000000000"
  31. ltid := strconv.FormatInt(end, 16) + "0000000000000000"
  32. return gteid, ltid
  33. }