zhangqian
2023-11-01 530fed8ec225453572d57b15c200ab062c335457
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,10 +69,12 @@
}
// List
//
//   @Tags      City
//   @Summary   获取城市列表
//   @Produce   application/json
//   @Success   200   {object}   contextx.Response{data=response.CityResponse}   "成功"
//   @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)
@@ -78,7 +82,9 @@
      return
   }
   cities, errCode := cityService.ListCities()
   // 获取省份ID
   provinceId, _ := strconv.Atoi(c.Query("province_id"))
   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