From 22dc412127b7fb00c1c7568aad09faaab19241d3 Mon Sep 17 00:00:00 2001
From: haozhifeng <haozhifeng>
Date: 星期一, 02 八月 2021 10:10:45 +0800
Subject: [PATCH] 带安装状态的app列表接口

---
 appApi.go |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/appApi.go b/appApi.go
index 9bf868c..a4f690d 100644
--- a/appApi.go
+++ b/appApi.go
@@ -8,6 +8,13 @@
 type AppApi struct{
 
 }
+type AppWithShop struct {
+	protomsg.App
+	RemoteVersion 	string 		 `json:"remoteVersion"` 		//鍟嗗煄浠撳簱鐗堟湰鍙�
+	Installed 		bool 		 `json:"installed"`     		//鏄惁宸插畨瑁�
+	IsUpgrade 		bool 		 `json:"isUpgrade"`     		//鏄惁闇�瑕佸崌绾�
+	ProgressMsg 	string       `json:"progressMsg"` 			//瀹夎鎴栧崌绾ц繘搴�
+}
 
 func (api AppApi) FindAll(appName string) (list []protomsg.App) {
 	url := DATA_URL_PREFIX + "/app/findAllApp"
@@ -121,4 +128,32 @@
 	}
 
 	return m
+}
+
+//鑾峰彇甯﹀畨瑁呯姸鎬佺殑app鍒楄〃
+func (api AppApi) FindAppWithInstallStatus(appName string) (list []AppWithShop) {
+	url := DATA_URL_PREFIX + "/app/findAllApp"
+	netNode := getNetNode(url2Topic(Topic_AppCenter_Service, url))
+	logPrint("netNode:", netNode)
+	client := NewClient(WithNodes(netNode))
+	paramMap := make(map[string]string, 0)
+	paramMap["appName"] = appName
+	respBody, err := client.DoGetRequest(url, paramMap, nil)
+	logPrint("DoGetRequest err:", err)
+	if err !=nil {
+		return nil
+	}
+	var res Result
+	if err = json.Unmarshal(respBody, &res); err != nil {
+		logPrint(err)
+		return nil
+	}
+	bytes, _ := json.Marshal(res.Data)
+	err = json.Unmarshal(bytes, &list)
+	if err == nil {
+		return list
+	} else {
+		logPrint("unmarshal err:", err)
+		return nil
+	}
 }
\ No newline at end of file

--
Gitblit v1.8.0