1234567891011121314151617181920212223242526272829303132333435363738 |
- package main
- import (
- u "data_tidb/util"
- "github.com/robfig/cron"
- "strconv"
- "time"
- )
- func init() {
- u.InitInfo() //初始化...
- //u.InitSaveService()//批量保存...
- }
- func main() {
- //标讯信息 655ff28faf7d908a8c546ec3
- //bidding.TaskBidding("100000000000000000000000", "655ff28faf7d908a8c546ec3")
- //定时增量...
- cr := cron.New()
- cr.AddFunc("0 0 9 ? * *", func() {
- if gteid, ltid := getCurTimePiInfo(); gteid != "" && ltid != "" {
- //bidding.TaskBidding(gteid, ltid)
- }
- })
- cr.Start()
- ch := make(chan bool, 1)
- <-ch
- }
- func getCurTimePiInfo() (string, string) {
- now := time.Now()
- start := time.Date(now.Year(), now.Month(), now.Day()-1, 0, 0, 0, 0, time.Local).Unix()
- end := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).Unix()
- gteid := strconv.FormatInt(start, 16) + "0000000000000000"
- ltid := strconv.FormatInt(end, 16) + "0000000000000000"
- return gteid, ltid
- }
|