64 lines
1.9 KiB
PHP
64 lines
1.9 KiB
PHP
<?php
|
|
defined('WXAPP_APP') OR exit('No direct script access allowed');
|
|
|
|
/**
|
|
* Created by Vim
|
|
* User: lcc
|
|
* Desc: 车系信息
|
|
* Date: 2020.06.23
|
|
* Time: 14:08
|
|
*/
|
|
require_once APPPATH.'controllers/wxapp/Wxapp.php';
|
|
class Series extends Wxapp{
|
|
|
|
function __construct($inputs, $app_key){
|
|
parent::__construct($inputs, $app_key);
|
|
|
|
$this->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;
|
|
}
|
|
|
|
}
|