From f45452ec05c97c26a8558f3e6398888ace9a7c5c Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期四, 18 六月 2020 10:57:02 +0800
Subject: [PATCH] add beijing restriction
---
conf/app.conf | 3 ++-
controllers/restriction.go | 12 ++++++++----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/conf/app.conf b/conf/app.conf
index ca9c8d4..0e54945 100644
--- a/conf/app.conf
+++ b/conf/app.conf
@@ -8,4 +8,5 @@
gendoc = true
downdoc = true
latestVersion = 1.0.0
-latestUrl =
\ No newline at end of file
+latestUrl =
+juheweihaokey = 8c0efc4439080ef6c6aa2c29688c9550
\ No newline at end of file
diff --git a/controllers/restriction.go b/controllers/restriction.go
index 8ce48ce..700b6fd 100644
--- a/controllers/restriction.go
+++ b/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 {
--
Gitblit v1.8.0