1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
| package bhomedbapi
|
| import (
| "basic.com/pubsub/protomsg.git"
| "encoding/json"
| )
|
| type VoiceApi struct{
|
| }
|
| //查找所有算法
| func (api VoiceApi) FindAll() (bool, []protomsg.Voice) {
| url := DATA_URL_PREFIX + "/voice/findAll"
| netNode := getNetNode(url2Topic(Topic_System_Service, url))
| var voiceArr []protomsg.Voice
| client := NewClient(WithNodes(netNode))
| respBody, err := client.DoGetRequest(url, nil, nil)
| if err !=nil {
| return false, nil
| }
| var res Result
| if err = json.Unmarshal(respBody, &res); err != nil {
| logPrint(err)
| return false, nil
| }
| bytes, _ := json.Marshal(res.Data)
| err = json.Unmarshal(bytes, &voiceArr)
| return res.Success, voiceArr
| }
|
|