Files
xiaoyu dc4885c449 cars
2025-03-07 23:01:46 +08:00

75 lines
1.8 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_brand_model extends HD_Model
{
private $table_name = 'lc_auto_brand';
private $status_arr = [ '-1' => '删除',0 => '下架',1 => '正常'];
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 = [];
$ids = array_filter($ids);
if ($ids) {
$cf_ids = implode(',', $ids);
$where = [
"id in ($cf_ids)" => null
];
$rows = $this->map('id', '', $where, '', '', '', $fileds);
}
return $rows;
}
/**
* 品牌字典
* @param array
* @param bool
* @return array
*/
public function map_brand($where=array(), $map=true){
if ($map){
$map_brand = $this->map('id', 'name', $where, 'initial asc', 0 , 0, 'id, name');
}
else{
$map_brand = $this->select($where, "initial asc", 0, 0, 'id, name');
}
return $map_brand;
}
/**
* 品牌字典带排序,用于select控件
* @param array
* @return array
*/
public function map_brand_list($map_brand){
$map_brand_list = array();
foreach ($map_brand as $key=>$val){
$map_brand_list[$key] = $val;
}
return $map_brand_list;
}
//获取状态
public function get_status(){
return $this->status_arr;
}
}