From 8465a546d08560b6858f1c55e9e9497f31ca1fa1 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期五, 14 六月 2019 13:09:53 +0800
Subject: [PATCH] add CameraTaskArgs.FindAll

---
 api_test.go |   59 ++++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 48 insertions(+), 11 deletions(-)

diff --git a/api_test.go b/api_test.go
index 700e322..e5a4e7d 100644
--- a/api_test.go
+++ b/api_test.go
@@ -2,13 +2,15 @@
 
 import (
 	"basic.com/pubsub/protomsg.git"
+	"encoding/json"
 	"fmt"
 	"testing"
+	"time"
 )
 
 func TestGetLocalCameraTree(t *testing.T) {
 	var api AreaApi
-	body := api.GetLocalCameraTree(0, 0, "c")
+	body := api.GetLocalCameraTree("0", "0", "c")
 	fmt.Println(body)
 }
 
@@ -18,8 +20,11 @@
 		Parentid: 0,
 		Name:     "鍝堝搱鍝�",
 	}
+	dataBytes, _ := json.Marshal(area)
+	paramBody := make(map[string]interface{},0)
+	json.Unmarshal(dataBytes,paramBody)
 
-	flag := api.AreaAdd(area)
+	flag := api.AreaAdd(paramBody)
 	fmt.Println(flag)
 }
 
@@ -30,7 +35,10 @@
 		Name:     "鍖哄煙鏇存柊娴嬭瘯",
 		Parentid: 0,
 	}
-	flag := api.AreaUpdate(area)
+	dataBytes, _ := json.Marshal(area)
+	paramBody := make(map[string]interface{},0)
+	json.Unmarshal(dataBytes,paramBody)
+	flag := api.AreaUpdate(paramBody)
 	fmt.Println(flag)
 }
 
@@ -46,19 +54,30 @@
 		Name:"娴嬭瘯鍟婂晩鍟婂晩鍟婂晩鍟婂晩",
 		Areaid:0,
 	}
-	result := api.CameraAdd(camera)
+	dataBytes, _ := json.Marshal(camera)
+	paramBody := make(map[string]interface{},0)
+	json.Unmarshal(dataBytes,paramBody)
+	result := api.CameraAdd(paramBody)
 	fmt.Println("add result: ",result)
 
 }
 
 func TestSdkApi_Save(t *testing.T) {
-	var api SdkApi
-	sdk := protomsg.Sdk{
-		SdkName:"娴嬭瘯sdk鍟婂晩鍟婂晩鍟�",
-
+	for {
+		time.Sleep(10 * time.Second)
+		var api SdkApi
+		sdk := protomsg.Sdk{
+			SdkName:"awfewagewag",
+			Icon:"bbb",
+			Url:"baidu",
+		}
+		dataBytes, _ := json.Marshal(sdk)
+		paramBody := make(map[string]interface{},0)
+		json.Unmarshal(dataBytes,paramBody)
+		result,data := api.Save(paramBody)
+		fmt.Println("add result: ",result,data)
 	}
-	result := api.Save(sdk)
-	fmt.Println("add result: ",result)
+
 }
 
 func TestMangosReqClient(t *testing.T){
@@ -73,7 +92,7 @@
 
 func TestSdkApi_GetById(t *testing.T) {
 	var api SdkApi
-	model := api.GetById("812b674b-2375-4589-919a-5c1c3278a97e")
+	model,_ := api.GetById("812b674b-2375-4589-919a-5c1c3278a97e")
 	fmt.Println(model)
 }
 
@@ -93,4 +112,22 @@
 	var api CameraApi
 	cameras := api.FindAll()
 	fmt.Println(cameras)
+}
+
+//鏌ユ壘鎵�鏈夌殑澶氳竟褰�
+func TestCameraApi_FindAllPolygons(t *testing.T) {
+	var api CameraApi
+	data := api.FindAllPolygons()
+	fmt.Println("polygons:",data)
+}
+
+func TestCameraApi_FindAllTimeRules(t *testing.T) {
+	var api CameraApi
+	_, rules := api.FindAllTimeRules()
+	fmt.Println("timeRules:",rules)
+}
+func TestCameraTaskArgsApi_FindAll(t *testing.T) {
+	var api CameraTaskArgsApi
+	all := api.FindAll()
+	fmt.Println("all:",all)
 }
\ No newline at end of file

--
Gitblit v1.8.0