| | |
| | | type RegionApi struct{} |
| | | |
| | | // Add |
| | | // |
| | | // @Tags Region |
| | | // @Summary 添加地区 |
| | | // @Produce application/json |
| | |
| | | } |
| | | |
| | | // Set |
| | | // |
| | | // @Tags Region |
| | | // @Summary 设置地区 |
| | | // @Produce application/json |
| | |
| | | } |
| | | |
| | | // Delete |
| | | // |
| | | // @Tags Region |
| | | // @Summary 删除地区 |
| | | // @Produce application/json |
| | |
| | | } |
| | | |
| | | // Update |
| | | // |
| | | // @Tags Region |
| | | // @Summary 更新地区 |
| | | // @Produce application/json |
| | |
| | | } |
| | | |
| | | // List |
| | | // |
| | | // @Tags Region |
| | | // @Summary 地区列表 |
| | | // @Produce application/json |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Param city_id query int true "城市ID" |
| | | // @Success 200 {object} contextx.Response{} |
| | | // @Router /api/region/list [get] |
| | | func (r *RegionApi) List(c *gin.Context) { |
| | | ctx, ok := contextx.NewContext(c, nil) |
| | |
| | | return |
| | | } |
| | | |
| | | regionList, errCode := regionService.ListRegions() |
| | | cityId, _ := strconv.Atoi(c.Query("city_id")) |
| | | regionList, errCode := regionService.ListRegions(cityId) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |