From e904a0672267d8f1b25fe92d0b08282f8b5b8d18 Mon Sep 17 00:00:00 2001
From: heyujie <516346543@qq.com>
Date: 星期五, 26 十一月 2021 14:01:30 +0800
Subject: [PATCH] 增加接口 GetUserProfile

---
 dbtableApi.go |   51 ++++++++++++++++++++++++---------------------------
 1 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/dbtableApi.go b/dbtableApi.go
index 62ff6a7..ba6b8c9 100644
--- a/dbtableApi.go
+++ b/dbtableApi.go
@@ -13,9 +13,6 @@
 func (api DbTableApi) AddDbTableInfo(paramBody map[string]interface{}) (bool,interface{}) {
 	url := DATA_URL_PREFIX + "/dbtable/addDbTableInfo"
 	netNode := getNetNode(url2Topic(Topic_CompTable_Service,url))
-	if netNode == nil {
-		return false,nil
-	}
 	client := NewClient(WithNodes(netNode))
 	body,err := client.DoPutRequest(url,CONTENT_TYPE_JSON, paramBody,nil)
 	if err != nil {
@@ -33,9 +30,6 @@
 func (api DbTableApi) QueryDbTables(isSync string) (bool,interface{}) {
 	url := DATA_URL_PREFIX + "/dbtable/queryDbTables"
 	netNode := getNetNode(url2Topic(Topic_CompTable_Service,url))
-	if netNode == nil {
-		return false,nil
-	}
 	client := NewClient(WithNodes(netNode))
 	paramQuery:= map[string]string {
 		"isSync":isSync,
@@ -56,9 +50,6 @@
 func (api DbTableApi) UpdateDbTables(paramBody map[string]interface{}) (bool,interface{}) {
 	url := DATA_URL_PREFIX + "/dbtable/updateDbTables"
 	netNode := getNetNode(url2Topic(Topic_CompTable_Service,url))
-	if netNode == nil {
-		return false,nil
-	}
 	client := NewClient(WithNodes(netNode))
 	body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
 	if err != nil {
@@ -76,9 +67,6 @@
 func (api DbTableApi) UpdateDbTableStatus(id string,enable int) (bool,interface{}) {
 	url := DATA_URL_PREFIX + "/dbtable/updateDbTableStatus"
 	netNode := getNetNode(url2Topic(Topic_CompTable_Service,url))
-	if netNode == nil {
-		return false,nil
-	}
 	client := NewClient(WithNodes(netNode))
 	paramBody := map[string]interface{}{
 		"id": id,
@@ -100,9 +88,6 @@
 func (api DbTableApi) DeleteById(id string) (bool,interface{}) {
 	url := DATA_URL_PREFIX + "/dbtable/deleteDBtablesById"
 	netNode := getNetNode(url2Topic(Topic_CompTable_Service,url))
-	if netNode == nil {
-		return false,nil
-	}
 	client := NewClient(WithNodes(netNode))
 	paramQuery := map[string]string {
 		"id": id,
@@ -124,9 +109,6 @@
 func (api DbTableApi) DbtablesById(ids []string) (dts []protomsg.Dbtable,err error) {
 	url := DATA_URL_PREFIX + "/dbtable/dbtablesByIds"
 	netNode := getNetNode(url2Topic(Topic_CompTable_Service,url))
-	if netNode == nil {
-		return nil,errors.New("compTable-service proc not found")
-	}
 	client := NewClient(WithNodes(netNode))
 	paramBody := map[string]interface{}{
 		"ids": ids,
@@ -162,9 +144,6 @@
 func (api DbTableApi) FindAllDbTables() (dts []protomsg.Dbtable,err error) {
 	url := DATA_URL_PREFIX + "/dbtable/findAllDbTables"
 	netNode := getNetNode(url2Topic(Topic_CompTable_Service,url))
-	if netNode == nil {
-		return nil,errors.New("compTable-service proc not found")
-	}
 	client := NewClient(WithNodes(netNode))
 	body,err := client.DoGetRequest(url, nil,nil)
 	if err != nil {
@@ -185,9 +164,6 @@
 func (api DbTableApi) FindAllDbTablesByCurServer(isDelete string) (dts []protomsg.Dbtable,err error){
 	url := DATA_URL_PREFIX + "/dbtable/findAllDbTablesByCurServer"
 	netNode := getNetNode(url2Topic(Topic_CompTable_Service,url))
-	if netNode == nil {
-		return nil,errors.New("compTable-service proc not found")
-	}
 	client := NewClient(WithNodes(netNode))
 	paramQuery := map[string]string{
 		"isDelete":isDelete,
@@ -208,12 +184,33 @@
 	return dts,nil
 }
 
+func (api DbTableApi) FindAllDbTablesByType(isDelete string, typ string) (dts []protomsg.Dbtable,err error){
+	url := DATA_URL_PREFIX + "/dbtable/findAllDbTablesByCurServer"
+	netNode := getNetNode(url2Topic(Topic_CompTable_Service,url))
+	client := NewClient(WithNodes(netNode))
+	paramQuery := map[string]string{
+		"isDelete":isDelete,
+		"type": typ,
+	}
+	body,err := client.DoGetRequest(url, paramQuery,nil)
+	if err != nil {
+		return nil,err
+	}
+
+	var res Result
+	if err = json.Unmarshal(body, &res); err != nil {
+		return nil,err
+	}
+	dataBytes, _ := json.Marshal(res.Data)
+	if err = json.Unmarshal(dataBytes, &dts);err !=nil {
+		return nil,err
+	}
+	return dts,nil
+}
+
 func (api DbTableApi) FindAllLocalDbTables(isDelete string) (dts []protomsg.Dbtable,err error){
 	url := DATA_URL_PREFIX + "/dbtable/findAllLocalDbTables"
 	netNode := getNetNode(url2Topic(Topic_CompTable_Service,url))
-	if netNode == nil {
-		return nil,errors.New("compTable-service proc not found")
-	}
 	client := NewClient(WithNodes(netNode))
 	paramQuery := map[string]string{
 		"isDelete":isDelete,

--
Gitblit v1.8.0