From 6f48881e4e82110c6161b457f64dc1369e60eb71 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期四, 22 八月 2019 11:58:18 +0800
Subject: [PATCH] add cluster.go
---
areaApi.go | 44 ++++++++++++++++++++++++++++++++++++--------
1 files changed, 36 insertions(+), 8 deletions(-)
diff --git a/areaApi.go b/areaApi.go
index 7ace60d..aa8da42 100644
--- a/areaApi.go
+++ b/areaApi.go
@@ -24,18 +24,48 @@
respBody, err := client.DoGetRequest(url, params, nil)
if err != nil {
- return result
+ return nil
}
var res Result
if err = json.Unmarshal(respBody, &res); err != nil {
- fmt.Println(err)
+ return nil
}
bytes, _ := json.Marshal(res.Data)
- err = json.Unmarshal(bytes, &result)
+ if err = json.Unmarshal(bytes, &result);err !=nil{
+ return nil
+ }
+ return result
+}
+
+//parentId 瑕佹煡瀵荤殑鐩綍鏍戠殑鏍硅妭鐐筰d
+//searchType(0:鍏ㄩ儴锛�1:鍒嗘瀽鎽勫儚鏈�,2:鐩戞帶鎽勫儚鏈�)
+//cameraName锛堟憚鍍忔満鍚嶇О锛�
+func (api AreaApi) GetGb28181CameraTree(parentId string, searchType string, cameraName string) []TreeMenu {
+ var result []TreeMenu
+
+ client := NewClient()
+
+ url := BASIC_URL + DATA_URL_PREFIX + "/area/gb28181Tree"
+ params := make(map[string]string, 0)
+ params["parentId"] = parentId
+ params["searchType"] = searchType
+ params["cameraName"] = cameraName
+
+ respBody, err := client.DoGetRequest(url, params, nil)
if err != nil {
- fmt.Println(err)
+ return nil
+ }
+
+ var res Result
+ if err = json.Unmarshal(respBody, &res); err != nil {
+ return nil
+ }
+
+ bytes, _ := json.Marshal(res.Data)
+ if err = json.Unmarshal(bytes, &result);err !=nil{
+ return nil
}
return result
}
@@ -51,7 +81,6 @@
}
var res Result
if err = json.Unmarshal(respBody, &res); err != nil {
- fmt.Println(err)
return flag
}
flag = res.Success
@@ -78,9 +107,9 @@
}
//鍒犻櫎鐩綍
-func (api AreaApi) AreaDelete(id int) bool {
+func (api AreaApi) AreaDelete(id string) bool {
flag := false
- if id == 0 {
+ if id == "" {
return flag
}
url := BASIC_URL + DATA_URL_PREFIX + "/area/del"
@@ -93,7 +122,6 @@
}
var res Result
if err = json.Unmarshal(respBody, &res); err != nil {
- fmt.Println(err)
return flag
}
flag = res.Success
--
Gitblit v1.8.0