package dbapi
|
//
|
//import (
|
// "basic.com/pubsub/protomsg.git"
|
// "encoding/json"
|
// "strconv"
|
//)
|
//
|
//type CameraTaskArgsApi struct {
|
// Ip string
|
// Port int
|
//}
|
//
|
//func (api CameraTaskArgsApi) getBasicUrl() string {
|
// if api.Ip == "" {
|
// return BASIC_URL
|
// }
|
// if api.Ip == "" {
|
// api.Ip = DEFAULT_IP
|
// }
|
// if api.Port == 0 {
|
// api.Port = DEFAULT_PORT
|
// }
|
// return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
|
//}
|
//
|
//func (api CameraTaskArgsApi) FindByCameraAndTask(cameraId string,taskId string,setType string) (bool,interface{}) {
|
// url := api.getBasicUrl() + DATA_URL_PREFIX + "/camera/getRulesByCameraAndTask"
|
// client := NewClient()
|
// paramQuery :=make(map[string]string)
|
// paramQuery["cameraId"] = cameraId
|
// paramQuery["taskId"] = taskId
|
// paramQuery["set_type"] = setType
|
// respBody, err := client.DoGetRequest(url, paramQuery,nil)
|
// if err != nil {
|
// return false,nil
|
// }
|
// var res Result
|
// if err = json.Unmarshal(respBody, &res); err != nil {
|
// return false,nil
|
// }
|
// return res.Success,res.Data
|
//}
|
//
|
//func (api CameraTaskArgsApi) UpdateDefenceStateByGroup(groupId string,defenceState bool)(bool,interface{}){
|
// url := api.getBasicUrl() + DATA_URL_PREFIX + "/cameraTaskArgs/updateDefenceStateByGroup"
|
// client := NewClient()
|
// paramBody :=make(map[string]interface{},0)
|
// paramBody["groupId"] = groupId
|
// paramBody["defenceState"] = defenceState
|
// respBody, err := client.DoPostRequest(url,CONTENT_TYPE_FORM,paramBody,nil,nil)
|
// if err != nil {
|
// return false,nil
|
// }
|
// var res Result
|
// if err = json.Unmarshal(respBody, &res); err != nil {
|
// return false,nil
|
// }
|
// return res.Success,res.Data
|
//}
|
//
|
//func (api CameraTaskArgsApi) DeleteByGroup(groupId string)(bool,interface{}) {
|
// url := api.getBasicUrl() + DATA_URL_PREFIX + "/cameraTaskArgs/deleteByGroup"
|
// client := NewClient()
|
// paramQuery :=make(map[string]string)
|
// paramQuery["groupId"] = groupId
|
// respBody, err := client.DoGetRequest(url, paramQuery,nil)
|
// if err != nil {
|
// return false,nil
|
// }
|
// var res Result
|
// if err = json.Unmarshal(respBody, &res); err != nil {
|
// return false,nil
|
// }
|
// return res.Success,res.Data
|
//}
|
//
|
//func (api CameraTaskArgsApi) FindAll() ([]protomsg.CameraTaskArgs){
|
// url := api.getBasicUrl() + DATA_URL_PREFIX + "/cameraTaskArgs/findAll"
|
// client := NewClient()
|
// respBody, err := client.DoGetRequest(url, nil,nil)
|
// if err != nil {
|
// return nil
|
// }
|
// var res Result
|
// if err = json.Unmarshal(respBody, &res); err != nil {
|
// return nil
|
// }
|
// arr :=make([]protomsg.CameraTaskArgs,0)
|
// dataBytes, _ := json.Marshal(res.Data)
|
// json.Unmarshal(dataBytes,&arr)
|
// return arr
|
//}
|
//
|
//func (api CameraTaskArgsApi) GetLinkRulesByCameraIds(paramBody map[string]interface{})(bool,interface{}){
|
// url := api.getBasicUrl() + DATA_URL_PREFIX + "/cameraTaskArgs/getLinkRulesByCameraIds"
|
// client := NewClient()
|
// respBody, err := client.DoPostRequest(url,CONTENT_TYPE_JSON,paramBody,nil,nil)
|
// if err != nil {
|
// return false,nil
|
// }
|
// var res Result
|
// if err = json.Unmarshal(respBody, &res); err != nil {
|
// return false,nil
|
// }
|
// return res.Success,res.Data
|
//}
|
//
|
//func (api CameraTaskArgsApi) SaveLinkRulesByGroup(paramBody map[string]interface{}) (bool,interface{}){
|
// url := api.getBasicUrl() + DATA_URL_PREFIX + "/cameraTaskArgs/saveLinkRulesByGroup"
|
// client := NewClient()
|
// respBody, err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody,nil, nil)
|
// if err != nil {
|
// return false,nil
|
// }
|
// var res Result
|
// if err = json.Unmarshal(respBody, &res); err != nil {
|
// return false,nil
|
// }
|
// return res.Success,res.Data
|
//}
|
//
|
//func (api CameraTaskApi) RuleApply2All(paramBody map[string]interface{}) (bool,interface{}) {
|
// url := api.getBasicUrl() + DATA_URL_PREFIX + "/cameraTaskArgs/ruleApply2All"
|
// client := NewClient()
|
// respBody, err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody,nil, nil)
|
// if err != nil {
|
// return false,nil
|
// }
|
// var res Result
|
// if err = json.Unmarshal(respBody, &res); err != nil {
|
// return false,nil
|
// }
|
// return res.Success,res.Data
|
//}
|