diff --git a/admin/controllers/autohome/Customer.php b/admin/controllers/autohome/Customer.php index ee26e61d..f921e6c5 100644 --- a/admin/controllers/autohome/Customer.php +++ b/admin/controllers/autohome/Customer.php @@ -441,8 +441,8 @@ class Customer extends HD_Controller $brands = $this->auto_brand_model->get_map_by_ids(array_column($rows, 'brand_id')); $series = $this->auto_series_model->get_map_by_ids(array_column($rows, 'series_id')); - $provinces = $this->area_model->get_map_by_ids(array_column($rows, 'province_id')); - $citys = $this->area_model->get_map_by_ids(array_column($rows, 'city_id')); + $provinces = $this->area_model->get_map_by_province_ids(array_column($rows, 'province_id')); + $citys = $this->area_model->get_map_by_city_ids(array_column($rows, 'city_id')); $map_biz = $this->biz_model->map('id', 'biz_name', ['status' => 1, 'province_id' => 350000], '', 0, 0, 'id,biz_name'); foreach ($rows as $val){ diff --git a/common/models/Area_model.php b/common/models/Area_model.php index 34afc635..29865d65 100644 --- a/common/models/Area_model.php +++ b/common/models/Area_model.php @@ -96,4 +96,32 @@ class Area_model extends HD_Model } return $rows; } + + public function get_map_by_city_ids($ids, $fileds = '', $map_key = 'id') + { + $rows = []; + $ids = array_filter($ids); + if ($ids) { + $cf_ids = implode(',', $ids); + $where = [ + "city_id in ($cf_ids)" => null + ]; + $rows = $this->map($map_key, '', $where, '', '', '', $fileds); + } + return $rows; + } + + public function get_map_by_province_ids($ids, $fileds = '', $map_key = 'id') + { + $rows = []; + $ids = array_filter($ids); + if ($ids) { + $cf_ids = implode(',', $ids); + $where = [ + "province_id in ($cf_ids)" => null + ]; + $rows = $this->map($map_key, '', $where, '', '', '', $fileds); + } + return $rows; + } }