更新最新数据.
This commit is contained in:
parent
5f7d92a781
commit
3d00fca1db
9
main.go
9
main.go
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
|
@ -30,7 +31,11 @@ func main() {
|
||||||
|
|
||||||
cla := engine.Table("count_live_anchors")
|
cla := engine.Table("count_live_anchors")
|
||||||
|
|
||||||
cur, err := mdb.C.CountLiveAnchors.Find(context.TODO(), bson.M{})
|
start, err := time.ParseInLocation("2006-01-02 15:04:03", "2020-11-30 16:29:17", time.Local)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
cur, err := mdb.C.CountLiveAnchors.Find(context.TODO(), bson.M{"create_at": bson.M{"$gte": start}})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -52,7 +57,7 @@ func main() {
|
||||||
c.CountMap = string(data)
|
c.CountMap = string(data)
|
||||||
_, err = cla.Insert(c)
|
_, err = cla.Insert(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
log.Println(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user