From 17b8325233d7bf3276a55bf0937bb76a5c88d67e Mon Sep 17 00:00:00 2001
From: 554325746@qq.com <554325746@qq.com>
Date: 星期三, 19 二月 2020 14:36:20 +0800
Subject: [PATCH] add

---
 controllers/gb28181.go |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 59 insertions(+), 0 deletions(-)

diff --git a/controllers/gb28181.go b/controllers/gb28181.go
new file mode 100644
index 0000000..1aade15
--- /dev/null
+++ b/controllers/gb28181.go
@@ -0,0 +1,59 @@
+package controllers
+
+import (
+   "basic.com/valib/logger.git"
+   "basic.com/dbapi.git"
+   "webserver/extend/code"
+   "webserver/extend/util"
+   "github.com/gin-gonic/gin"
+)
+
+type Gb28181Controller struct {
+
+}
+
+// @Summary 鑾峰彇鍥芥爣鍖哄煙鍒楄〃
+// @Description  鑾峰彇鍥芥爣鍖哄煙鍒楄〃
+// @Produce json
+// @Tags gb28181
+// @Param parentId query int true "parentId"
+// @Success 200 {string} json "{"code":200, success:true, msg:"", data:"鎴愬姛淇℃伅"}"
+// @Failure 500 {string} json "{"code":500, success:false, msg:"",data:"閿欒淇℃伅鍐呭"}"
+// @Router /data/api-v/gb28181/findAreaByParentId [get]
+func (gbc Gb28181Controller) FindAreaByParentId(c *gin.Context) {
+   parentIdStr := c.Query("parentId")
+   if parentIdStr == "" {
+       parentIdStr = "0"
+   }
+   logger.Debug("FindAreaByParentId pid:",parentIdStr)
+   var api dbapi.Gb28181Api
+   b, d := api.FindAreaByParentId(parentIdStr)
+   if !b {
+       util.ResponseFormat(c,code.ComError,"")
+       return
+   }
+   util.ResponseFormat(c,code.Success,d)
+}
+
+// @Summary 鐢熸垚鏂扮殑鍥芥爣id
+// @Description 鐢熸垚鏂扮殑鍥芥爣id
+// @Produce json
+// @Tags gb28181
+// @Param code query string 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/gb28181/newGbId [get]
+func (gbc Gb28181Controller) NewGbId(c *gin.Context) {
+  areaCode := c.Query("code")
+  if areaCode == "" || len(areaCode) != 6{
+      util.ResponseFormat(c, code.RequestParamError, "鍙傛暟鏈夎")
+      return
+  }
+  var api dbapi.Gb28181Api
+  b, d := api.NewGbId(areaCode)
+  if !b {
+     util.ResponseFormat(c,code.ComError,"")
+     return
+  }  
+  util.ResponseFormat(c,code.Success,d)
+}

--
Gitblit v1.8.0