sqlite的api,便于内部使用
liuxiaolong
2019-06-22 3ea90a522ec1679e3c244b245e5554fe320c2cb1
add camera.GetCamerasByRunType
2个文件已修改
38 ■■■■■ 已修改文件
cameraApi.go 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
syssetApi.go 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cameraApi.go
@@ -4,6 +4,7 @@
    "basic.com/pubsub/protomsg.git"
    "encoding/json"
    "fmt"
    "strconv"
)
type CameraApi struct{}
@@ -282,3 +283,31 @@
    }
    return true,res.Data
}
//根据运行类型获取摄像机列表
//runType(0:获取轮询列表,1:获取实时列表)
func (api CameraApi) GetCamerasByRunType(runType int)(flag bool,cameras []protomsg.Camera){
    url := BASIC_URL + DATA_URL_PREFIX + "/camera/getCamerasByRunType"
    client := NewClient()
    paramQuery := make(map[string]string,0)
    paramQuery["runType"]=strconv.Itoa(runType)
    body, err := client.DoGetRequest(url, paramQuery, nil)
    if err != nil {
        return false,nil
    }
    var res Result
    if err = json.Unmarshal(body, &res); err != nil {
        return false,nil
    }
    b, err := json.Marshal(res.Data)
    if err !=nil {
        fmt.Println("unmarshal GetCamerasByRunType.result err")
        return false,nil
    }
    if err = json.Unmarshal(b, &cameras);err !=nil {
        return false,nil
    } else {
        return true,cameras
    }
}
syssetApi.go
@@ -35,3 +35,12 @@
        }
    }
}
//保存轮询配置
func (api SysSetApi) SavePollConfig(paramBody map[string]interface{}) bool{
    return false
}
//获取轮询配置
func (api SysSetApi) GetPollConfig() (bool,interface{}) {
    return false,nil
}