59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
class Auto_finance_model extends HD_Model{
|
|
private $table_name = 'lc_auto_car_finance';
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct($this->table_name, 'default');
|
|
}
|
|
|
|
public function count_finance($where){
|
|
return $this->select_finance($where,'','','','',1);
|
|
}
|
|
|
|
public function select_finance($where = array(), $order = '', $page = 0, $page_size = 20 , $fileds = '', $count = 0){
|
|
!$fileds && $fileds = 'lc_auto_car_finance.*';
|
|
$this->db->select($fileds);
|
|
$this->db->from('lc_auto_car_finance');
|
|
$this->db->join('lc_auto_cars', 'lc_auto_cars.id = lc_auto_car_finance.car_id','left');
|
|
|
|
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();
|
|
}
|
|
/**
|
|
* 期数
|
|
* @return array
|
|
*/
|
|
public function get_nums(){
|
|
$nums = [12,24,36,48,60];
|
|
return $nums;
|
|
}
|
|
|
|
/**
|
|
* 状态
|
|
* @return array
|
|
*/
|
|
function status_ary(){
|
|
$statusAry = ['0' => '关闭', '1' => '开启'];
|
|
|
|
return $statusAry;
|
|
}
|
|
}
|