From 1ca4109013bb07f7f55093357bf68fcfe435e0f2 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期一, 27 七月 2020 14:57:13 +0800 Subject: [PATCH] fix string array unmarshal and config hikUrl --- service/carService.go | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/service/carService.go b/service/carService.go index 902f44b..2be9199 100644 --- a/service/carService.go +++ b/service/carService.go @@ -1,10 +1,12 @@ package service import ( - "car-service/models" reqUtil "car-service/extend/util" + "car-service/models" "encoding/json" "fmt" + "github.com/astaxie/beego" + "strconv" ) type CarService struct { hikUtil *reqUtil.HikHttpUtil @@ -15,7 +17,7 @@ hikUtil: &reqUtil.HikHttpUtil{ AppKey: hikAppKey, AppSecret: hikAppSecret, - ReqHost: "https://172.16.35.50:1443", + ReqHost: beego.AppConfig.String("hikUrl"), }, } } @@ -150,10 +152,15 @@ func (sv *CarService) FindSpaceNo() models.PosResult { resultList := make(models.PosResult,0) for k,_ := range models.SpaceNo2Pos { + st := 0 + i, _ := strconv.Atoi(k) + if i >= 50 && i <=60 { + st = 1 + } resultList = append(resultList, models.PosInfo { SpaceNo: k, PosNo: "", - State: 0, + State: st, PlateNo: "", }) } -- Gitblit v1.8.0