zhangmeng
2024-01-19 01dfd9dc8de7b19f9dfa4284722e01bbd5837801
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
31
32
33
34
35
36
37
38
39
40
41
42
43
package bhomedbapi
 
import jsoniter "github.com/json-iterator/go"
 
type CameraGroupApi struct {
}
 
func (api CameraGroupApi) FindAll() (flag bool, list interface{}) {
    url := DATA_URL_PREFIX + "/camera/group/findAll"
    netNode := getNetNode(url2Topic(Topic_Scene_Service, url))
    client := NewClient(WithNodes(netNode))
    body, err := client.DoGetRequest(url, nil, nil)
    if err != nil {
        logPrint("camera group findAll err:", err)
        return false, nil
    }
 
    var res Result
    var json = jsoniter.ConfigCompatibleWithStandardLibrary
    if err = json.Unmarshal(body, &res); err != nil {
        logPrint("relations unmarshal err:", err)
        return false, nil
    }
 
    return res.Success, res.Data
}
 
func (api CameraGroupApi) Save(paramBody map[string]interface{}) (bool, interface{}) {
    url := DATA_URL_PREFIX + "/camera/group/save"
    netNode := getNetNode(url2Topic(Topic_Scene_Service, url))
    client := NewClient(WithNodes(netNode))
    body, err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody, nil, nil)
    if err != nil {
        return false, nil
    }
 
    var res Result
    var json = jsoniter.ConfigCompatibleWithStandardLibrary
    if err = json.Unmarshal(body, &res); err != nil {
        return false, nil
    }
    return res.Success, res.Data
}