diff --git a/api/controllers/wxapp/app/Series.php b/api/controllers/wxapp/app/Series.php index 19879f30..3da82078 100644 --- a/api/controllers/wxapp/app/Series.php +++ b/api/controllers/wxapp/app/Series.php @@ -162,7 +162,7 @@ class Series extends Wxapp{ $rows = $this->auto_cars_model->select($where,'id desc',$page,$size,'id,s_id,v_id'); if($rows){ $target_arr = array_unique(array_column($rows,'v_id')); - $attrs = $this->auto_attr_model->get_map_by_ids($target_arr,'id,title'); + $attrs = $this->auto_attr_model->get_map_by_ids($target_arr,'id,title',1); foreach($attrs as $key => $val){ $lists[] = [ 'id' => $key, diff --git a/common/models/auto/Auto_attr_model.php b/common/models/auto/Auto_attr_model.php index fed0fcd0..35b78b3e 100644 --- a/common/models/auto/Auto_attr_model.php +++ b/common/models/auto/Auto_attr_model.php @@ -24,16 +24,16 @@ class Auto_attr_model extends HD_Model{ * @param string $fileds * @return array */ - public function get_map_by_ids($ids, $fileds = '') + public function get_map_by_ids($ids, $fileds = '',$status='') { $rows = []; $ids = array_filter($ids); if ($ids) { $cf_ids = implode(',', $ids); $where = [ - "status" => 1, "id in ($cf_ids)" => null ]; + strlen($status) && $where['status'] = $status; $rows = $this->map('id', '', $where, '', '', '', $fileds); } return $rows;