sunty
2020-08-20 9303b69ea569bcb5e581147543a3fd58e90d0d25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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 == "" {
      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)
}