table_name, 'default'); $this->load->model('auto/auto_brand_model'); $this->load->model('auto/auto_series_model'); } /** * 获取手机号关注品牌 * @param $mobile * @return array */ public function getBrandsByMobile($mobile) { $where = [ 'mobile' => $mobile ]; $rows = $this->select($where, 'id desc', '', '', 'DISTINCT brand_id,series_id'); $brandList = []; if($rows){ $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')); foreach ($rows as $v) { $brandName = $brands[$v['brand_id']] ? $brands[$v['brand_id']][0]['name'] : ''; $seriesName = $series[$v['series_id']] ? $series[$v['series_id']][0]['name'] : ''; $brandList[] = "$brandName-$seriesName"; } } return $brandList; } }