liuxiaolong
2021-04-25 cc9d7e2dfad7c634e8ce69d02ce5fc4065e809e4
cameraApi.go
@@ -3,7 +3,6 @@
import (
   "basic.com/pubsub/protomsg.git"
   "encoding/json"
   "errors"
   "strconv"
)
@@ -14,9 +13,6 @@
func (api CameraApi) CameraAdd(paramBody map[string]interface{}) (bool,interface{}) {
   url := DATA_URL_PREFIX + "/camera/add"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return false,nil
   }
   client := NewClient(WithNodes(netNode))
   body, err := client.DoPostRequest(url,CONTENT_TYPE_JSON,paramBody,nil,nil)
   if err != nil {
@@ -33,9 +29,6 @@
func (api CameraApi) CameraUpdate(paramBody map[string]interface{}) bool {
   url := DATA_URL_PREFIX + "/camera/update"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return false
   }
   client := NewClient(WithNodes(netNode))
   body, err := client.DoPutRequest(url,CONTENT_TYPE_JSON,paramBody,nil)
   if err != nil {
@@ -52,9 +45,6 @@
func (api CameraApi) UpdateSnapshotUrl(cameraId string, snapshot string) bool {
   url := DATA_URL_PREFIX + "/camera/updateSnapshot"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return false
   }
   client := NewClient(WithNodes(netNode))
   paramBody :=make(map[string]interface{},0)
   paramBody["snapshot"] = snapshot
@@ -76,9 +66,6 @@
func (api CameraApi) CameraDelete(cid string) bool {
   url := DATA_URL_PREFIX + "/camera/del"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return false
   }
   client := NewClient(WithNodes(netNode))
   paramMap := make(map[string]string,0)
   paramMap["id"] = cid
@@ -98,9 +85,6 @@
func (api CameraApi) GetCameraById(cameraId string) (camera protomsg.Camera, err error) {
   url := DATA_URL_PREFIX + "/camera/show"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return camera,errors.New("camera-service not found")
   }
   client := NewClient(WithNodes(netNode))
   paramQuery := map[string]string {
      "id": cameraId,
@@ -124,9 +108,6 @@
func (api CameraApi) UpdateCameraArea(cameraId string, areaId string) bool {
   url := DATA_URL_PREFIX + "/camera/updateCameraArea"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return false
   }
    client := NewClient(WithNodes(netNode))
    paramBody := map[string]interface{} {
        "cameraId": cameraId,
@@ -148,9 +129,6 @@
func (api CameraApi) FindAll(cameraName string, runType string, cameraId string, areaId string) (cameras []protomsg.Camera) {
   url := DATA_URL_PREFIX + "/camera/showAll"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return nil
   }
   client := NewClient(WithNodes(netNode))
   paramQuery := map[string]string {
      "cameraName": cameraName,
@@ -179,9 +157,6 @@
func (api CameraApi) GetAllCamerasByServer(serverId string,cameraName string) (b bool,cams []protomsg.Camera) {
   url := DATA_URL_PREFIX + "/camera/getAllCamerasByServer"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return false,nil
   }
   client := NewClient(WithNodes(netNode))
   paramQuery := make(map[string]string,0)
   paramQuery["serverId"] = serverId
@@ -229,9 +204,6 @@
func (api CameraApi) GetCamerasByRunType(runType int,cameraName string)(flag bool,cameras []protomsg.Camera){
   url := DATA_URL_PREFIX + "/camera/getCamerasByRunType"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return false,nil
   }
   client := NewClient(WithNodes(netNode))
   paramQuery := make(map[string]string,2)
   paramQuery["runType"]=strconv.Itoa(runType)
@@ -260,9 +232,6 @@
func (api CameraApi) UpdateRunEnable(cameraId string,runEnable bool) (bool,interface{}){
   url := DATA_URL_PREFIX + "/camera/updateRunEnable"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return false, nil
   }
   client := NewClient(WithNodes(netNode))
   paramBody :=make(map[string]interface{},0)
   paramBody["cameraId"] = cameraId
@@ -284,9 +253,6 @@
func (api CameraApi) UpdateIsRunningState(cameraId string,isRunning bool) (bool,interface{}){
   url := DATA_URL_PREFIX + "/camera/updateIsRunningState"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return false,nil
   }
   client := NewClient(WithNodes(netNode))
   paramBody :=make(map[string]interface{},0)
   paramBody["cameraId"] = cameraId
@@ -308,9 +274,6 @@
func (api CameraApi) UpdateIsRunningAll(cameraIds []string) (bool,interface{}){
   url := DATA_URL_PREFIX + "/camera/updateIsRunningAll"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return false,nil
   }
   client := NewClient(WithNodes(netNode))
   paramBody :=make(map[string]interface{},0)
   paramBody["cameraIds"] = cameraIds
@@ -332,9 +295,6 @@
func (api CameraApi) ChangeRunType(paramBody map[string]interface{}) (bool,interface{}){
   url := DATA_URL_PREFIX + "/camera/changeRunType"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return false,nil
   }
   client := NewClient(WithNodes(netNode))
   body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
   if err != nil {
@@ -353,9 +313,6 @@
func (api CameraApi) StatisticRunInfo() (bool,interface{}){
   url := DATA_URL_PREFIX + "/camera/statisticRunInfo"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return false,nil
   }
   client := NewClient(WithNodes(netNode))
   body, err := client.DoGetRequest(url, nil, nil)
   if err != nil {
@@ -372,9 +329,6 @@
func (api CameraApi) FindAllCameraLink() (b bool,list []protomsg.CameraLink){
   url := DATA_URL_PREFIX + "/camera/findAllCameraLink"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return false,nil
   }
   client := NewClient(WithNodes(netNode))
   body, err := client.DoGetRequest(url, nil, nil)
   if err != nil {
@@ -395,9 +349,6 @@
func (api CameraApi) FindOnMap(isOnMap bool, floor int, cameraName string) (b bool, cams []protomsg.Camera) {
   url := DATA_URL_PREFIX + "/camera/findOnMap"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return false,nil
   }
   client := NewClient(WithNodes(netNode))
   paramBody:= map[string]interface{}{
      "isOnMap":    isOnMap,
@@ -427,9 +378,6 @@
func (api CameraApi) UpdatePos(id string, floor int, longitude float32, latitude float32) bool {
   url := DATA_URL_PREFIX + "/camera/updatePos"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return false
   }
   client := NewClient(WithNodes(netNode))
   paramBody:= map[string]interface{}{
      "id":    id,
@@ -454,9 +402,6 @@
func (api CameraApi) NodeCamera() (bool, interface{}) {
   url := DATA_URL_PREFIX + "/camera/nodeCamera"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return false,nil
   }
   client := NewClient(WithNodes(netNode))
   body, err := client.DoGetRequest(url, nil, nil)
   if err != nil {
@@ -473,9 +418,6 @@
func (api CameraApi) Coord(cameraId string) (bool, interface{}) {
   url := DATA_URL_PREFIX + "/camera/coord"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return false,nil
   }
   client := NewClient(WithNodes(netNode))
   paramQuery := map[string]string {
      "cameraId": cameraId,
@@ -495,9 +437,6 @@
func (api CameraApi) UpdateCoord(paramBody map[string]interface{}) bool {
   url := DATA_URL_PREFIX + "/camera/updateCoord"
   netNode := getNetNode(url2Topic(Topic_Camera_Service, url))
   if netNode == nil {
      return false
   }
   client := NewClient(WithNodes(netNode))
   body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
   if err != nil {