liuxiaolong
2020-06-19 5df344667773da880d521ef45a4ca497af355d05
fix restriction schedule
2个文件已修改
4 ■■■ 已修改文件
controllers/restriction.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
main.go 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/restriction.go
@@ -42,7 +42,7 @@
func Schedule() {
    c := cron.New()
    //每天凌晨5点执行一次,获取当日数据
    c.AddFunc("0 0 5 * * ?", func() {
    c.AddFunc("0 0 1 * * ?", func() {
        todayRes = nil
        getRestrictionInfo()
    })
main.go
@@ -1,6 +1,7 @@
package main
import (
    "car-service/controllers"
    _ "car-service/routers"
    "github.com/astaxie/beego"
)
@@ -10,5 +11,6 @@
        beego.BConfig.WebConfig.DirectoryIndex = true
        beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"
    }
    controllers.Schedule()
    beego.Run()
}