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)
|
}
|