123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- package isapi
- import (
- "github.com/gin-gonic/gin"
- "github.com/sirupsen/logrus"
- "io/ioutil"
- "lc-fangdaosha/isapi"
- )
- //区域入侵
- type FieldDetectionApi struct {
- }
- // GetFieldDetectionCap 获取单个通道区域入侵规则参数配置能力
- func (api FieldDetectionApi) GetFieldDetectionCap(c *gin.Context) {
- host, err := GetHost(c)
- if err != nil {
- logrus.Errorf("获取host失败:%s", err.Error())
- return
- }
- isapi.TouChuan(host, isapi.GetFieldDetectionCap, nil, c)
- }
- // GetSizeFd 获取监测目标的尺寸
- func (api FieldDetectionApi) GetSizeFd(c *gin.Context) {
- host, err := GetHost(c)
- if err != nil {
- logrus.Errorf("获取host失败:%s", err.Error())
- return
- }
- isapi.TouChuan(host, isapi.GetFieldDetectionCal, nil, c)
- }
- // PutSizeFd 配置监测目标的尺寸
- func (api FieldDetectionApi) PutSizeFd(c *gin.Context) {
- defer c.Request.Body.Close()
- all, err := ioutil.ReadAll(c.Request.Body)
- if err != nil {
- logrus.Errorf("读取数据失败:%e\n", err)
- }
- host, err := GetHost(c)
- if err != nil {
- logrus.Errorf("获取设备连接失败:%e\n", err)
- return
- }
- isapi.TouChuan(host, isapi.PutFieldDetectionCal, all, c)
- }
- // GetFieldDetection 获取单个通道区域入侵侦测规则
- func (api FieldDetectionApi) GetFieldDetection(c *gin.Context) {
- host, err := GetHost(c)
- if err != nil {
- logrus.Errorf("获取host失败:%s", err.Error())
- return
- }
- isapi.TouChuan(host, isapi.GetFieldDetection, nil, c)
- }
- // PutFieldDetection 配置单个通道区域入侵侦测规则
- func (api FieldDetectionApi) PutFieldDetection(c *gin.Context) {
- defer c.Request.Body.Close()
- all, err := ioutil.ReadAll(c.Request.Body)
- if err != nil {
- logrus.Errorf("读取数据失败:%e\n", err)
- return
- }
- host, err := GetHost(c)
- if err != nil {
- logrus.Errorf("获取设备连接失败:%e\n", err)
- return
- }
- isapi.TouChuan(host, isapi.PutRegionEntrance, all, c)
- }
|