| | |
| | | |
| | | // List |
| | | // |
| | | // @Tags City |
| | | // @Summary 获取城市列表 |
| | | // @Produce application/json |
| | | // @Param provinceId query int false "省份ID" |
| | | // @Success 200 {object} contextx.Response{data=response.CityResponse} "成功" |
| | | // @Router /api/city/list [get] |
| | | // @Tags City |
| | | // @Summary 获取城市列表 |
| | | // @Produce application/json |
| | | // @Param province_id query int false "省份ID" |
| | | // @Success 200 {object} contextx.Response{data=response.CityResponse} "成功" |
| | | // @Router /api/city/list [get] |
| | | func (ci *CityApi) List(c *gin.Context) { |
| | | ctx, ok := contextx.NewContext(c, nil) |
| | | if !ok { |
| | |
| | | } |
| | | |
| | | // 获取省份ID |
| | | provinceId, _ := strconv.Atoi(c.Query("provinceId")) |
| | | provinceId, _ := strconv.Atoi(c.Query("province_id")) |
| | | cities, errCode := cityService.ListCities(provinceId) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |