From 114b298c2af545e7b63ed5888142dabf5fa62e06 Mon Sep 17 00:00:00 2001 From: wangpengfei <274878379@qq.com> Date: 星期一, 17 七月 2023 18:28:23 +0800 Subject: [PATCH] fix --- api/v1/city.go | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-) diff --git a/api/v1/city.go b/api/v1/city.go index 3c37915..724b032 100644 --- a/api/v1/city.go +++ b/api/v1/city.go @@ -13,6 +13,7 @@ type CityApi struct{} // Add +// // @Tags City // @Summary 娣诲姞鍩庡競 // @Produce application/json @@ -44,6 +45,7 @@ } // Set +// // @Tags City // @Summary 璁剧疆鍩庡競 // @Produce application/json @@ -67,18 +69,22 @@ } // List -// @Tags City -// @Summary 鑾峰彇鍩庡競鍒楄〃 -// @Produce application/json -// @Success 200 {object} contextx.Response{data=response.CityResponse} "鎴愬姛" -// @Router /api/city/list [get] +// +// @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] func (ci *CityApi) List(c *gin.Context) { ctx, ok := contextx.NewContext(c, nil) if !ok { return } - cities, errCode := cityService.ListCities() + // 鑾峰彇鐪佷唤ID + provinceId, _ := strconv.Atoi(c.Query("provinceId")) + cities, errCode := cityService.ListCities(provinceId) if errCode != ecode.OK { ctx.Fail(errCode) return @@ -90,6 +96,7 @@ } // Delete +// // @Tags City // @Summary 鍒犻櫎鍩庡競 // @Produce application/json @@ -113,6 +120,7 @@ } // Update +// // @Tags City // @Summary 鏇存柊鍩庡競 // @Produce application/json -- Gitblit v1.8.0