68 lines
1.7 KiB
PHP
68 lines
1.7 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
/**
|
|
* Created by Vim.
|
|
* User: lcc
|
|
* Date: 2021/06/23
|
|
* Time: 16:24
|
|
*/
|
|
class Auto_series_model extends HD_Model{
|
|
private $table_name = 'lc_auto_series';
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct($this->table_name, 'default');
|
|
}
|
|
|
|
/**
|
|
* Notes:根据id获取数据
|
|
* Created on: 2021/7/15 17:27
|
|
* Created by: dengbw
|
|
* @param $ids
|
|
* @param string $fileds
|
|
* @return array
|
|
*/
|
|
public function get_map_by_ids($ids, $fileds = '')
|
|
{
|
|
$rows = [];
|
|
if ($ids) {
|
|
$ids = array_filter($ids);
|
|
$cf_ids = implode(',', $ids);
|
|
$where = [
|
|
"id in ($cf_ids)" => null
|
|
];
|
|
$rows = $this->map('id', '', $where, '', '', '', $fileds);
|
|
}
|
|
return $rows;
|
|
}
|
|
|
|
//获取车系品牌
|
|
public function select_brand($where=[],$order,$page,$size,$fileds='',$count=''){
|
|
|
|
!$fileds && $fileds = 'lc_auto_series.*,lc_auto_brand.name as b_name' ;
|
|
$this->db->select($fileds);
|
|
$this->db->from('lc_auto_series');
|
|
$this->db->join('lc_auto_brand', 'lc_auto_brand.id = lc_auto_series.brand_id');
|
|
|
|
if ($where) {
|
|
$this->db->where($where);
|
|
}
|
|
if ($count) {
|
|
return $this->db->count_all_results();
|
|
}
|
|
if ($order) {
|
|
$this->db->order_by($order);
|
|
}
|
|
if ($page) {
|
|
$offset = ($page - 1) * $page_size;
|
|
$limit = $page_size;
|
|
} else {
|
|
$offset = null;
|
|
$limit = null;
|
|
}
|
|
$this->db->limit($limit, $offset);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
}
|