From 7c811247ecf143e08c576986a884bedadc57dd66 Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期五, 05 六月 2020 18:29:41 +0800
Subject: [PATCH] add refresh token to resp

---
 controllers/cameraTaskArgs.go |   43 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/controllers/cameraTaskArgs.go b/controllers/cameraTaskArgs.go
index e402cb4..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"
 )
 
@@ -13,7 +14,7 @@
 
 }
 
-
+// @Security ApiKeyAuth
 // @Summary 鏍规嵁鎽勫儚鏈篿d鍜屼换鍔d鏌ヨ绠楁硶閰嶇疆璇︽儏
 // @Description 鏍规嵁鎽勫儚鏈篿d鍜屼换鍔d鏌ヨ绠楁硶閰嶇疆璇︽儏
 // @Produce json
@@ -42,6 +43,7 @@
 	}
 }
 
+// @Security ApiKeyAuth
 // @Summary 鏍规嵁澶氫釜鎽勫儚鏈篿d鏌ヨ鑱斿姩浠诲姟瑙勫垯璁剧疆
 // @Description 鏍规嵁澶氫釜鎽勫儚鏈篿d鏌ヨ鑱斿姩浠诲姟瑙勫垯璁剧疆
 // @Accept json
@@ -67,8 +69,10 @@
 	}
 }
 
+// @Security ApiKeyAuth
 // @Summary 鏍规嵁鍒嗙粍id鍒囨崲甯冮槻鎴栨挙闃�
 // @Description 鏍规嵁鍒嗙粍id鍒囨崲甯冮槻鎴栨挙闃�
+// @Accept x-www-form-urlencoded
 // @Produce json
 // @Tags CameraTaskArgs
 // @Param groupId formData string true "浠诲姟绠楁硶鍙傛暟鍒嗙粍id"
@@ -93,6 +97,7 @@
 	}
 }
 
+// @Security ApiKeyAuth
 // @SUmmary 鏍规嵁鍒嗙粍id鍒犻櫎鎽勫儚鏈虹畻娉曡鍒�
 // @Description 鏍规嵁鍒嗙粍id鍒犻櫎鎽勫儚鏈虹畻娉曡鍒�
 // @Produce json
@@ -144,6 +149,7 @@
 	GroupId string `json:"group_id"`//鍒嗙粍id
 }
 
+// @Security ApiKeyAuth
 // @Summary 淇濆瓨鑱斿姩浠诲姟瑙勫垯鍙傛暟
 // @Description 淇濆瓨鑱斿姩浠诲姟瑙勫垯鍙傛暟
 // @Accept json
@@ -166,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