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 * @apiHeader {string} Content-Type=application/json 传输方式 * * @apiParam {String} [key="''"] 区域标识 * * @apiSuccess (200) {Number} code 成功响应状态码! * @apiSuccess (200) {String} msg 成功提示 * @apiSuccess (200) {Json} 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) }