| | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (CityService) ListCities() ([]*model.City, int) { |
| | | func (CityService) ListCities(id int) ([]*model.City, int) { |
| | | // get city list |
| | | list, err := model.NewCitySearch().FindAll() |
| | | if err != nil { |
| | | return nil, ecode.CityListErr |
| | | if id != 0 { |
| | | list, err := model.NewCitySearch().SetProvinceId(id).FindAll() |
| | | if err != nil { |
| | | return nil, ecode.CityListErr |
| | | } |
| | | return list, ecode.OK |
| | | } else { |
| | | list, err := model.NewCitySearch().FindAll() |
| | | if err != nil { |
| | | return nil, ecode.CityListErr |
| | | } |
| | | return list, ecode.OK |
| | | } |
| | | |
| | | return list, ecode.OK |
| | | } |
| | | |
| | | func (CityService) DeleteCity(id int) int { |