Files
ArmedPolice/app/api/config.go
2021-11-04 16:44:42 +08:00

53 lines
1.1 KiB
Go

package api
import (
"ArmedPolice/app/controller/config"
"ArmedPolice/app/service"
"github.com/gin-gonic/gin"
)
type Config struct{}
/**
* @apiDefine Config 配置管理
*/
/**
* @api {get} /api/v1/config/area 区域信息
* @apiVersion 1.0.0
* @apiName ConfigArea
* @apiGroup Config
*
* @apiHeader {string} x-token token
*
* @apiParam {String} [key="''"] 区域标识
*
* @apiSuccess (200) {Number} code 成功响应状态码!
* @apiSuccess (200) {String} msg 成功提示
* @apiSuccess (200) {Object} data 数据信息{"110000": "北京市", "120000": "天津市", ...}
*
* @apiSuccessExample {json} Success response:
* HTTPS 200 OK
* {
* "code": 200
* "msg": "ok"
* "data": {
* "110000": "北京市",
* "120000": "天津市",
* "130000": "河北省",
* "140000": "山西省",
* }
* }
*/
func (*Config) Area(c *gin.Context) {
form := &struct {
Key string `json:"key" form:"key"`
}{}
if err := bind(form)(c); err != nil {
APIFailure(err.(error))(c)
return
}
data := config.NewInstance()(getSession()(c).(*service.Session)).Area(form.Key)
APIResponse(nil, data)(c)
}