From cb76e3197809c7f6e3e27269271bff97e5252ada Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期二, 26 一月 2021 19:17:23 +0800
Subject: [PATCH] add dic ListByType
---
dicApi.go | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/dicApi.go b/dicApi.go
index 0ebc8c1..3a52bd1 100644
--- a/dicApi.go
+++ b/dicApi.go
@@ -48,4 +48,32 @@
return false,nil
}
return res.Success,res.Data
+}
+
+func (api DicApi) ListByType(typ string) (flag bool,list []protomsg.Dic){
+ url := DATA_URL_PREFIX + "/dictionary/listByType"
+ netNode := getNetNode(url2Topic(Topic_System_Service, url))
+ if netNode == nil {
+ return false,nil
+ }
+ client := NewClient(WithNodes(netNode))
+ paramMap := make(map[string]string)
+ paramMap["type"] = typ
+ respBody, err := client.DoGetRequest(url, paramMap, nil)
+ if err !=nil {
+ return false,nil
+ }
+ var res Result
+ if err = json.Unmarshal(respBody, &res); err != nil {
+ logPrint(err)
+ return false,nil
+ }
+ if res.Success {
+ dataBytes, _ := json.Marshal(res.Data)
+ if err = json.Unmarshal(dataBytes, &list);err !=nil {
+ return false,nil
+ }
+ return true, list
+ }
+ return false, nil
}
\ No newline at end of file
--
Gitblit v1.8.0