regionEntrance.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package isapi
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "github.com/sirupsen/logrus"
  5. "io/ioutil"
  6. "lcfns/isapi"
  7. )
  8. type RegionEntranceApi struct {
  9. }
  10. // GetRegionEntranceCap 获取单个通道区域入侵规则参数配置能力
  11. func (api RegionEntranceApi) GetRegionEntranceCap(c *gin.Context) {
  12. host, err := GetHost(c)
  13. if err != nil {
  14. logrus.Errorf("获取host失败:%e\n", err)
  15. return
  16. }
  17. isapi.TouChuan(host, isapi.GetRegionEntranceCap, nil, c)
  18. }
  19. // GetSizeRe 区域入侵
  20. func (api RegionEntranceApi) GetSizeRe(c *gin.Context) {
  21. host, err := GetHost(c)
  22. if err != nil {
  23. logrus.Errorf("获取host失败:%e\n", err)
  24. return
  25. }
  26. isapi.TouChuan(host, isapi.GetRegionEntranceCal, nil, c)
  27. }
  28. func (api RegionEntranceApi) PutSizeRe(c *gin.Context) {
  29. defer c.Request.Body.Close()
  30. data, err := ioutil.ReadAll(c.Request.Body)
  31. if err != nil {
  32. logrus.Errorf("读取数据失败:%e\n", err)
  33. return
  34. }
  35. host, err := GetHost(c)
  36. if err != nil {
  37. logrus.Errorf("获取host失败:%e\n", err)
  38. return
  39. }
  40. isapi.TouChuan(host, isapi.PutRegionEntranceCal, data, c)
  41. }
  42. func (api RegionEntranceApi) GetRegionEntrance(c *gin.Context) {
  43. host, err := GetHost(c)
  44. if err != nil {
  45. logrus.Errorf("获取host失败:%e\n", err)
  46. return
  47. }
  48. isapi.TouChuan(host, isapi.GetRegionEntrance, nil, c)
  49. }
  50. func (api RegionEntranceApi) PutRegionEntrance(c *gin.Context) {
  51. defer c.Request.Body.Close()
  52. data, err := ioutil.ReadAll(c.Request.Body)
  53. if err != nil {
  54. logrus.Errorf("读取数据失败:%e\n", err)
  55. return
  56. }
  57. host, err := GetHost(c)
  58. if err != nil {
  59. logrus.Errorf("获取host失败:%e\n", err)
  60. return
  61. }
  62. isapi.TouChuan(host, isapi.PutRegionEntrance, data, c)
  63. }