From 3ea90a522ec1679e3c244b245e5554fe320c2cb1 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期六, 22 六月 2019 11:00:47 +0800
Subject: [PATCH] add camera.GetCamerasByRunType

---
 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