liuxiaolong
2020-09-07 d36e0b699b56d5b6fb0abf30508b94c98b4b28ca
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package main
 
import (
    "car-service/controllers"
    "car-service/models"
    _ "car-service/routers"
    "car-service/service"
    "github.com/astaxie/beego"
    "github.com/robfig/cron"
)
 
func main() {
    if beego.BConfig.RunMode == "dev" {
        beego.BConfig.WebConfig.DirectoryIndex = true
        beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"
    }
    models.InitDb()
    go controllers.ComputeSpaceLeftRealTime()
    //每天同步海康数据,看人员id是否有发生变化
    c := cron.New()
    c.AddFunc("@daily", func() {
        service.SyncHikPerson()
    })
    c.Start()
    beego.Run()
}