From 01dfd9dc8de7b19f9dfa4284722e01bbd5837801 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期五, 19 一月 2024 09:10:30 +0800 Subject: [PATCH] replace json to json-iterator --- cameraGroupApi.go | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-) diff --git a/cameraGroupApi.go b/cameraGroupApi.go index 4ee8094..3c13c57 100644 --- a/cameraGroupApi.go +++ b/cameraGroupApi.go @@ -1,12 +1,11 @@ package bhomedbapi -import json "github.com/json-iterator/go" +import jsoniter "github.com/json-iterator/go" type CameraGroupApi struct { - } -func (api CameraGroupApi) FindAll() (flag bool,list interface{}) { +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)) @@ -17,26 +16,28 @@ } var res Result + var json = jsoniter.ConfigCompatibleWithStandardLibrary if err = json.Unmarshal(body, &res); err != nil { logPrint("relations unmarshal err:", err) - return false,nil + return false, nil } return res.Success, res.Data } -func (api CameraGroupApi) Save(paramBody map[string]interface{}) (bool,interface{}) { +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) + body, err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody, nil, nil) if err != nil { - return false,nil + return false, nil } var res Result + var json = jsoniter.ConfigCompatibleWithStandardLibrary if err = json.Unmarshal(body, &res); err != nil { - return false,nil + return false, nil } - return res.Success,res.Data -} \ No newline at end of file + return res.Success, res.Data +} -- Gitblit v1.8.0