From b1984656c83c4c166d332b05c790975c3d10a1dd Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期二, 25 六月 2019 14:50:05 +0800
Subject: [PATCH] fix bug
---
cameraApi.go | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/cameraApi.go b/cameraApi.go
index c5c9a4b..95dc8a3 100644
--- a/cameraApi.go
+++ b/cameraApi.go
@@ -4,6 +4,7 @@
"basic.com/pubsub/protomsg.git"
"encoding/json"
"fmt"
+ "strconv"
)
type CameraApi struct{}
@@ -281,4 +282,32 @@
return false,nil
}
return true,res.Data
+}
+
+//鏍规嵁杩愯绫诲瀷鑾峰彇鎽勫儚鏈哄垪琛�
+//runType(0:鑾峰彇杞鍒楄〃锛�1锛氳幏鍙栧疄鏃跺垪琛�)
+func (api CameraApi) GetCamerasByRunType(runType int)(flag bool,cameras []protomsg.Camera){
+ url := BASIC_URL + DATA_URL_PREFIX + "/camera/getCamerasByRunType"
+ client := NewClient()
+ paramQuery := make(map[string]string,0)
+ paramQuery["runType"]=strconv.Itoa(runType)
+ body, err := client.DoGetRequest(url, paramQuery, nil)
+ if err != nil {
+ return false,nil
+ }
+
+ var res Result
+ if err = json.Unmarshal(body, &res); err != nil {
+ return false,nil
+ }
+ b, err := json.Marshal(res.Data)
+ if err !=nil {
+ fmt.Println("unmarshal GetCamerasByRunType.result err")
+ return false,nil
+ }
+ if err = json.Unmarshal(b, &cameras);err !=nil {
+ return false,nil
+ } else {
+ return true,cameras
+ }
}
\ No newline at end of file
--
Gitblit v1.8.0