From 789d38603d73dabe8ae5f79c1a35a8d84c130b00 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期三, 04 三月 2020 18:20:47 +0800
Subject: [PATCH] update protomsg
---
controllers/camera.go | 42 +++++++++++++++++++++++++++++++++---------
1 files changed, 33 insertions(+), 9 deletions(-)
diff --git a/controllers/camera.go b/controllers/camera.go
index 3b62747..bea1cc0 100644
--- a/controllers/camera.go
+++ b/controllers/camera.go
@@ -40,6 +40,20 @@
RunEnable bool `json:"run_enable"` //鎺у埗瀹炴椂澶勭悊鎴栬疆璇㈠鐞嗙殑寮�鍏�
RunType int `json:"run_type"` //澶勭悊绫诲瀷锛�0锛氳疆璇紝1锛氬疄鏃�
RunServerId string `json:"run_server_id"` //褰撳墠姝e湪澶勭悊鐨勫垎鏋愭湇鍔″櫒id
+
+ Sensors []SensorVo `json:"sensors"` //浼犳劅鍣ㄥ垪琛�
+}
+
+type SensorVo struct {
+ Id string `json:"id"`
+ Type int `json:"type"`
+ Ip string `json:"ip"`
+ Port int `json:"port"`
+ Username string `json:"username"`
+ Password string `json:"password"`
+ Threshold int `json:"threshold"`
+ Enable bool `json:"enable"`
+ DevId string `json:"devId"`
}
// @Summary 娣诲姞鎽勫儚鏈�
@@ -203,18 +217,27 @@
// @Security ApiKeyAuth
// @Summary 灏嗘憚鍍忔満鎸傚埌鎸囧畾鐨勭洰褰曟爲涓�
// @Description 灏嗘憚鍍忔満鎸傚埌鎸囧畾鐨勭洰褰曟爲涓�
+// @Accept x-www-form-urlencoded
// @Produce json
// @Tags camera
-// @Param cameraId path string true "鎽勫儚鏈篿d"
-// @Param areaId path string true "鐩綍鍖哄煙id"
+// @Param cameraId formData string true "鎽勫儚鏈篿d"
+// @Param areaId formData string true "鐩綍鍖哄煙id"
// @Success 200 {string} json "{"code":200, success:true, msg:"璇锋眰澶勭悊鎴愬姛", data:""}"
// @Failure 500 {string} json "{"code":500, success:false, msg:"",data:"閿欒淇℃伅鍐呭"}"
-// @Router /data/api-v/camera/cameraAreaAdd [get]
-func (ac CameraController) CameraAreaAdd(c *gin.Context) {
- cameraId := c.Param("cameraId")
- areaId := c.Param("areaId")
- fmt.Println(cameraId)
- fmt.Println(areaId)
+// @Router /data/api-v/camera/updateCameraArea [post]
+func (ac CameraController) UpdateCameraArea(c *gin.Context) {
+ cameraId := c.PostForm("cameraId")
+ areaId := c.PostForm("areaId")
+ if cameraId == "" || areaId == "" {
+ util.ResponseFormat(c, code.RequestParamError, "鍙傛暟鏈夎")
+ return
+ }
+ var api dbapi.CameraApi
+ if api.UpdateCameraArea(cameraId, areaId) {
+ util.ResponseFormat(c,code.Success,"鏇存柊鎴愬姛")
+ } else {
+ util.ResponseFormat(c,code.ComError,"")
+ }
}
// @Security ApiKeyAuth
@@ -339,7 +362,7 @@
util.ResponseFormat(c, code.RequestParamError, "鍙傛暟鏈夎")
return
}
- if strings.HasPrefix(cid, File_Video_Id_Pre) || strings.HasPrefix(cid, File_Video_Id_Pre) || strings.HasPrefix(cid, File_Video_Id_Pre) {
+ if strings.HasPrefix(cid, File_Video_Id_Pre) || strings.HasPrefix(cid, File_Img_Id_Pre) || strings.HasPrefix(cid, File_Audio_Id_Pre) {
var fileApi dbapi.FileAnalysisApi
b, d := fileApi.Show(cid)
if b {
@@ -351,6 +374,7 @@
"cameraId": cid,
"snapshotUrl": file.SnapshotUrl,
})
+ return
} else {
util.ResponseFormat(c, code.ComError, "鏇存柊澶辫触")
return
--
Gitblit v1.8.0