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

---
 sdkApi.go |   41 +++++++++++++++++++----------------------
 1 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/sdkApi.go b/sdkApi.go
index 91c46b3..3286bae 100644
--- a/sdkApi.go
+++ b/sdkApi.go
@@ -1,4 +1,4 @@
-package dbapi
+package bhomedbapi
 
 import (
 	"basic.com/pubsub/protomsg.git"
@@ -13,9 +13,6 @@
 func (api SdkApi)Register(paramBody map[string]interface{}) (bool,interface{}) {
 	url := DATA_URL_PREFIX + "/sdk/register"
 	netNode := getNetNode(url2Topic(Topic_AppCenter_Service, url))
-	if netNode == nil {
-		return false,nil
-	}
 	flag := false
 	client := NewClient(WithNodes(netNode))
 	respBody, err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody, nil, nil)
@@ -34,9 +31,6 @@
 func (api SdkApi) FindAll(sdkName string)[]protomsg.Sdk{
 	url := DATA_URL_PREFIX + "/sdk/findAllSdk"
 	netNode := getNetNode(url2Topic(Topic_AppCenter_Service, url))
-	if netNode == nil {
-		return nil
-	}
 	var sdkArr []protomsg.Sdk
 	client := NewClient(WithNodes(netNode))
 	paramMap := make(map[string]string, 0)
@@ -109,9 +103,6 @@
 func (api SdkApi) GetById(id string) (bool,interface{}){
 	url := DATA_URL_PREFIX + "/sdk/getById"
 	netNode := getNetNode(Topic_AppCenter_Service)
-	if netNode == nil {
-		return false,nil
-	}
 	client := NewClient(WithNodes(netNode))
 	paramMap := make(map[string]string)
 	paramMap["id"] = id
@@ -130,9 +121,6 @@
 func (api SdkApi) FindByTaskId(taskId string) (flag bool,sdks []protomsg.Sdk) {
 	url := DATA_URL_PREFIX + "/sdk/findByTaskId"
 	netNode := getNetNode(url2Topic(Topic_AppCenter_Service, url))
-	if netNode == nil {
-		return false,nil
-	}
 	client := NewClient(WithNodes(netNode))
 	paramMap := make(map[string]string)
 	paramMap["taskId"] = taskId
@@ -153,9 +141,6 @@
 func (api SdkApi) GetSdkArgs(sdkId string, scope string) (b bool,args []protomsg.SdkArg) {
 	url := DATA_URL_PREFIX + "/sdkArg/getSdkArgs"
 	netNode := getNetNode(url2Topic(Topic_AppCenter_Service, url))
-	if netNode == nil {
-		return false,nil
-	}
 	client := NewClient(WithNodes(netNode))
 	paramMap := make(map[string]string)
 	paramMap["sdkId"] = sdkId
@@ -177,9 +162,6 @@
 func (api SdkApi) GetAllSdkChanSet() (b bool, list []protomsg.SdkChanSet) {
 	url := DATA_URL_PREFIX + "/sdk/getAllSdkChanSet"
 	netNode := getNetNode(url2Topic(Topic_AppCenter_Service, url))
-	if netNode == nil {
-		return false,nil
-	}
     client := NewClient(WithNodes(netNode))
     respBody,err := client.DoGetRequest(url, nil, nil)
     if err !=nil {
@@ -200,9 +182,6 @@
 func (api SdkApi) UpdateSdkChanSet(paramBody map[string]interface{}) bool {
 	url := DATA_URL_PREFIX + "/sdk/updateSdkChanSet"
 	netNode := getNetNode(url2Topic(Topic_AppCenter_Service, url))
-	if netNode == nil {
-		return false
-	}
     client := NewClient(WithNodes(netNode))
     respBody,err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody, nil, nil)
     if err !=nil {
@@ -214,3 +193,21 @@
     }
     return res.Success
 }
+
+func (api SdkApi) Delete(sdkId string) (bool, interface{}) {
+	url := DATA_URL_PREFIX + "/sdk/delete"
+	netNode := getNetNode(url2Topic(Topic_AppCenter_Service, url))
+	client := NewClient(WithNodes(netNode))
+	paramBody := map[string]interface{}{
+		"sdkId": sdkId,
+	}
+	respBody,err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody, nil, nil)
+	if err !=nil {
+		return false, err.Error()
+	}
+	var res Result
+	if err = json.Unmarshal(respBody, &res);err !=nil {
+		return false, err.Error()
+	}
+	return res.Success, res.Data
+}
\ No newline at end of file

--
Gitblit v1.8.0