fix
wangpengfei
2023-07-17 114b298c2af545e7b63ed5888142dabf5fa62e06
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