From e5a6b19048e1314bc6efbeb253bb39c661f49547 Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期四, 18 六月 2020 11:05:12 +0800
Subject: [PATCH] add isxianxing

---
 controllers/restriction.go |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/controllers/restriction.go b/controllers/restriction.go
index 8ce48ce..c4d4fdd 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()
 	})
@@ -49,6 +53,7 @@
 	Date 		string 		`json:"date"`
 	Week 		string 		`json:"week"`
 	CityName 	string		`json:"cityName"`
+	IsXianXing 	int 		`json:"isxianxing"`
 	XxWeiHao 	[]int		`json:"xxWeiHao"`
 }
 
@@ -72,7 +77,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 {
@@ -88,6 +93,7 @@
 			Date: result.Result.Date,
 			Week: result.Result.Week,
 			CityName: result.Result.CityName,
+			IsXianXing: result.Result.IsXianXing,
 			XxWeiHao: result.Result.XXWeiHao,
 		}
 	}

--
Gitblit v1.8.0