login_white = array();//登录白名单 $this->check_status = array();//用户状态校验 $this->check_mobile = array();//需要手机号 $this->check_headimg =array();//授权微信信息 } //获取车型列表 protected function get_cars(){ $this->load->model('auto/auto_brand_model'); $this->load->model('auto/auto_series_model'); $id = $this->input_param('id'); //车系id $where = [ 'status' => 1 ]; $rows = $this->auto_series_model-> select($where,'',1,20,'id,brand_id,name'); $list = []; if($rows){ $first = []; $brand_arr = array_unique(array_column($rows,'brand_id')); $brands = []; $brand_ids = implode(',',$brand_arr); if($brand_ids){ $where = [ "id in ({$brand_ids})" => null, ]; $brand_rows = $this->auto_brand_model->map('id','',$where,'','','','id,name'); } foreach($rows as $key=>$val){ $brand_name = isset($brand_rows[$val['brand_id']]) ? $brand_rows[$val['brand_id']][0]['name'] : ''; $temp = [ 'id' => $val['id'], 'title' => $brand_name.$val['name'], ]; if($val['id']==$id){ $first[] = $temp; }else{ $list[] = $temp; } } $list = array_merge($first,$list); } return $list; } //获取车系属性 public function get_attrs(){ $s_id = $this->input_param('id'); $type = $this->input_param('type'); $page = $this->input_param('page'); $size = $this->input_param('size'); !$page && $page = 1; !$size && $size = 20; $this->load->model('auto/auto_attr_model'); $where = [ 's_id' => $s_id ]; strlen($type) && $where['type'] = $type; $count = $this->auto_attr_model->count($where); $rows = $this->auto_attr_model->select($where,'id desc',$page,$size,'id,title,type,jsondata'); $lists = []; if($rows){ foreach($rows as $key=>$val){ $jsodnata = json_decode($val['jsondata'],true); $temp = [ 'id' => $val['id'], 'title' => $val['title'] ]; if($val['type']==1){ $temp['price'] = $jsodnata['price']; $temp['deposit'] = $jsodnata['deposit']; } $lists[] = $temp; } } $data = [ 'list' => $lists, 'total' => $count ]; return $data; } }