From 8b9f4b0a54ccd281b38c41ec928e35d810a74202 Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期四, 11 六月 2020 13:49:59 +0800
Subject: [PATCH] fix FindAllTaskSdkRun

---
 taskApi.go |   43 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/taskApi.go b/taskApi.go
index 1bd69f1..d44f44a 100644
--- a/taskApi.go
+++ b/taskApi.go
@@ -3,7 +3,6 @@
 import (
 	"basic.com/pubsub/protomsg.git"
 	"encoding/json"
-	"fmt"
 	"strconv"
 )
 
@@ -36,7 +35,27 @@
 	}
 	var res Result
 	if err = json.Unmarshal(respBody, &res); err != nil {
-		fmt.Println(err)
+		logPrint(err)
+		return taskInfos
+	}
+	bytes, _ := json.Marshal(res.Data)
+	err = json.Unmarshal(bytes, &taskInfos)
+	return taskInfos
+}
+
+func (api TaskApi) FindAllTaskDefaultArgs(scope string)(taskInfos []protomsg.TaskSdkInfo) {
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/task/findAll"
+	client := NewClient()
+	queryParam := map[string]string {
+		"scope": scope,
+	}
+	respBody, err := client.DoGetRequest(url, queryParam, nil)
+	if err !=nil {
+		return taskInfos
+	}
+	var res Result
+	if err = json.Unmarshal(respBody, &res); err != nil {
+		logPrint(err)
 		return taskInfos
 	}
 	bytes, _ := json.Marshal(res.Data)
@@ -56,8 +75,8 @@
 			}
 			m := make(map[string]string,0)
 			for _,s := range ti.Sdks{
-				if _,ok :=m[s.IpcId];!ok{
-					m[s.IpcId] = s.IpcId
+				if _,ok :=m[s.SdkType];!ok{
+					m[s.SdkType] = s.SdkType
 					tsr.Sdks = append(tsr.Sdks,&protomsg.SdkRun{
 						IpcId:s.IpcId,
 						SdkType:s.SdkType,
@@ -80,7 +99,7 @@
 	}
 	var res Result
 	if err = json.Unmarshal(respBody, &res); err != nil {
-		fmt.Println(err)
+		logPrint(err)
 		return false,nil
 	}
 	return res.Success,res.Data
@@ -162,4 +181,18 @@
 		return false,nil
 	}
 	return res.Success,res.Data
+}
+
+func (api TaskApi) StatisticTaskCamera() (bool,interface{}) {
+	url := api.getBasicUrl() + DATA_URL_PREFIX + "/task/statisticTaskCamera"
+	client := NewClient()
+	respBody, err := client.DoGetRequest(url, nil, nil)
+	if err != nil {
+		return false,nil
+	}
+	var res Result
+	if err = json.Unmarshal(respBody, &res); err != nil {
+		return false,nil
+	}
+	return res.Success,res.Data
 }
\ No newline at end of file

--
Gitblit v1.8.0