From 590c075d30a61f9ecb380a908860d6c827526e09 Mon Sep 17 00:00:00 2001
From: panlei <2799247126@qq.com>
Date: 星期四, 22 八月 2019 16:08:24 +0800
Subject: [PATCH] Merge branch 'master' of https://192.168.1.14/r/dbapi

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