| | |
| | | |
| | | import ( |
| | | "basic.com/dbapi.git" |
| | | "github.com/gin-gonic/gin" |
| | | "webserver/extend/code" |
| | | "webserver/extend/util" |
| | | "fmt" |
| | | "github.com/gin-gonic/gin" |
| | | ) |
| | | |
| | | type CameraPolygonController struct { |
| | |
| | | |
| | | type CameraPolygonVo struct { |
| | | CameraId string `json:"camera_id"` //摄像机id |
| | | SnapshotUrl string `json:"snapshot_url"` //快照地址 |
| | | Line []PolygonS `json:"line"` //画的所有线 |
| | | Rect []PolygonS `json:"rect"` //矩形 |
| | | Arrow []PolygonS `json:"arrow"` //箭头 |
| | |
| | | Y float64 `json:"y"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 保存摄像机多边形 |
| | | // @Description 保存摄像机多边形 |
| | | // @Accept json |
| | |
| | | func (controller CameraPolygonController) Save(c *gin.Context) { |
| | | paramBody := make(map[string]interface{},0) |
| | | c.BindJSON(¶mBody) |
| | | fmt.Println(paramBody) |
| | | var api dbapi.CameraApi |
| | | flag, data := api.SaveCameraPolygon(paramBody) |
| | | if flag { |
| | |
| | | util.ResponseFormat(c,code.ComError,"保存失败") |
| | | } |
| | | |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 删除摄像机区域 |
| | | // @Description 删除摄像机区域 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags 摄像机多边形 |
| | | // @Param id query string true "id" |
| | |
| | | util.ResponseFormat(c,code.ComError,"删除") |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查找摄像机区域 |
| | | // @Description 查找摄像机区域 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags 摄像机多边形 |
| | | // @Param cameraId query string true "cameraId" |
| | |
| | | if flag { |
| | | util.ResponseFormat(c,code.Success,data) |
| | | } else { |
| | | util.ResponseFormat(c,code.ComError,data) |
| | | util.ResponseFormat(c,code.ComError,"更新失败") |
| | | } |
| | | } |
| | | |