From 9303b69ea569bcb5e581147543a3fd58e90d0d25 Mon Sep 17 00:00:00 2001
From: sunty <1172534965@qq.com>
Date: 星期四, 20 八月 2020 20:05:23 +0800
Subject: [PATCH] add get buckets contrl

---
 controllers/cameraTaskArgs.go |   36 +++++++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/controllers/cameraTaskArgs.go b/controllers/cameraTaskArgs.go
index 0b3d25f..325d59f 100644
--- a/controllers/cameraTaskArgs.go
+++ b/controllers/cameraTaskArgs.go
@@ -2,10 +2,11 @@
 
 import (
 	"basic.com/dbapi.git"
+	"basic.com/valib/logger.git"
 	"github.com/gin-gonic/gin"
 	"strconv"
+	"strings"
 	"webserver/extend/code"
-	"basic.com/valib/logger.git"
 	"webserver/extend/util"
 )
 
@@ -171,4 +172,37 @@
 	} else {
 		util.ResponseFormat(c,code.ComError,data)
 	}
+}
+
+type RuleApply2AllVo struct {
+	CameraId   string  			  `json:"camera_id" binding:"required"`//瑙勫垯鎷ユ湁鑰卛d
+}
+
+// @Summary 灏嗘湰鏉¤鍒欏簲鐢ㄥ埌鎵�鏈夋湰鍦拌棰�
+// @Description 灏嗘湰鏉¤鍒欏簲鐢ㄥ埌鎵�鏈夋湰鍦拌棰�
+// @Produce json
+// @Tags CameraTaskArgs
+// @Param args body controllers.RuleApply2AllVo true "瑙勫垯搴旂敤鍒版墍鏈夋湰鍦拌棰戣姹傚弬鏁�"
+// @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}"
+// @Failure 500 {string} json "{"code":500, success:false, msg:"",data:""}"
+// @Router /data/api-v/cameraTaskArgs/ruleApply2All [post]
+func (controller CameraTaskArgsController) RuleApply2All(c *gin.Context) {
+	var saveBody RuleApply2AllVo
+	err := c.BindJSON(&saveBody)
+	if err !=nil {
+		util.ResponseFormat(c, code.RequestParamError, "鍙傛暟鏈夎")
+		return
+	}
+	if !strings.HasPrefix(saveBody.CameraId, File_Video_Id_Pre) && !strings.HasPrefix(saveBody.CameraId, File_Img_Id_Pre) && !!strings.HasPrefix(saveBody.CameraId, File_Audio_Id_Pre) {
+		util.ResponseFormat(c, code.RequestParamError, "鍙傛暟鏈夎")
+		return
+	}
+	var api dbapi.CameraTaskApi
+	paramBody := util.Struct2Map(saveBody)
+	flag, data := api.RuleApply2All(paramBody)
+	if flag {
+		util.ResponseFormat(c,code.Success,data)
+	} else {
+		util.ResponseFormat(c, code.ComError, data)
+	}
 }
\ No newline at end of file

--
Gitblit v1.8.0