From e904a0672267d8f1b25fe92d0b08282f8b5b8d18 Mon Sep 17 00:00:00 2001 From: heyujie <516346543@qq.com> Date: 星期五, 26 十一月 2021 14:01:30 +0800 Subject: [PATCH] 增加接口 GetUserProfile --- deviceCtlApi.go | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/deviceCtlApi.go b/deviceCtlApi.go index 5967550..783a883 100644 --- a/deviceCtlApi.go +++ b/deviceCtlApi.go @@ -1,7 +1,7 @@ package bhomedbapi import ( - "basic.com/valib/bhshmq.git/proto/source/bhome_msg" + "basic.com/valib/c_bhomebus.git/proto/source/bhome_msg" "encoding/json" ) @@ -9,10 +9,10 @@ } -func (api DeviceCtlApi) DevAuthApply(devId string, ip string, key string) (bool,interface{}) { +func (api DeviceCtlApi) DevAuthApply(targetIp string, fromDevId string, fromIp string, key string) (bool,interface{}) { url := DATA_URL_PREFIX + "/devAuth/apply" dest := &bhome_msg.BHAddress{ - Ip: []byte(ip), + Ip: []byte(targetIp), } netNode := append([]*bhome_msg.MsgQueryTopicReply_BHNodeAddress{}, &bhome_msg.MsgQueryTopicReply_BHNodeAddress{ Addr: dest, @@ -20,9 +20,9 @@ client := NewClient(WithNodes(netNode)) paramBody := map[string]interface{} { - "key": key, - "fromDevId": devId, - "fromIp": ip, + "key": key, + "fromDevId": fromDevId, + "fromIp": fromIp, } body,err := client.DoPutRequest(url,CONTENT_TYPE_JSON, paramBody,nil) if err != nil { @@ -37,9 +37,15 @@ return res.Success,res.Data } -func (api DeviceCtlApi) DevDetail(devId string) (bool, interface{}) { +func (api DeviceCtlApi) DevDetail(targetIp string, devId string) (bool, interface{}) { url := DATA_URL_PREFIX + "/device/detail" - netNode := getNetNode(url2Topic(Topic_System_Service,url)) + + dest := &bhome_msg.BHAddress{ + Ip: []byte(targetIp), + } + netNode := append([]*bhome_msg.MsgQueryTopicReply_BHNodeAddress{}, &bhome_msg.MsgQueryTopicReply_BHNodeAddress{ + Addr: dest, + }) paramQuery := map[string]string { "devId": devId, -- Gitblit v1.8.0