liuxiaolong
2020-06-18 f45452ec05c97c26a8558f3e6398888ace9a7c5c
add beijing restriction
2个文件已修改
15 ■■■■■ 已修改文件
conf/app.conf 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/restriction.go 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
conf/app.conf
@@ -8,4 +8,5 @@
gendoc = true
downdoc = true
latestVersion = 1.0.0
latestUrl =
latestUrl =
juheweihaokey = 8c0efc4439080ef6c6aa2c29688c9550
controllers/restriction.go
@@ -13,11 +13,15 @@
    beego.Controller
}
func init() {
    getRestrictionInfo()
}
// @Title 查询限行尾号
// @Description 查询限行尾号
// @Success 200 {object} controllers.RestrictionResult
// @Failure 403 {string} json ""
// @router /spaceNo [get]
// @router /restriction [get]
func (c *RestrictionController) Restriction() {
    resp := code.Code{}
    if todayRes !=nil {
@@ -37,8 +41,8 @@
func Schedule() {
    c := cron.New()
    //每小时监测一次是否过期
    c.AddFunc("0 0 * * * ?", func() {
    //每天凌晨5点执行一次,获取当日数据
    c.AddFunc("0 0 5 * * ?", func() {
        todayRes = nil
        getRestrictionInfo()
    })
@@ -72,7 +76,7 @@
}
func getRestrictionInfo() {
    juHeAppKey := ""
    juHeAppKey := beego.AppConfig.String("juheweihaokey")
    url := "http://v.juhe.cn/xianxing/index?key="+ juHeAppKey +"&city=beijing&type=1"
    b, err := util.DoPostRequest(url, util.CONTENT_TYPE_JSON, nil, nil, nil)
    if err != nil {