Files
2025-12-02 14:30:49 +08:00

74 lines
1.9 KiB
PHP

<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Receiver_orders_model extends HD_Model
{
private $table_name = 'lc_receiver_orders';
private $status_arr = [0 => '签约下定', 1 => '发票开具', 2 => '车辆交付', 3 => '已完成'];
const CPS_TYPE_OTHER = 0; //其它车型
const CPS_TYPE_IMPORTANT = 1; //重点品牌
const CPS_TYPE_NORMAl = 2; //常规品牌
const CPS_TYPES = [
self::CPS_TYPE_OTHER => '其它品牌',
self::CPS_TYPE_IMPORTANT => '重点品牌',
self::CPS_TYPE_NORMAl => '常规品牌',
];
public function __construct()
{
parent::__construct($this->table_name, 'default');
$this->load->model("sys/sys_cps_model");
}
/**
* Notes:订单状态
* @return array
*/
public function get_status($status = '')
{
if (strlen($status)) {
$return_status = $this->status_arr[$status];
} else {
$return_status = $this->status_arr;
}
return $return_status;
}
public function downpayment_type($type = 0)
{
$array = [1 => '现金', 2 => '0首付', 3 => '按揭'];
if (isset($type)) {
return $array[$type] ? $array[$type] : '';
} else {
return $array;
}
}
/**
* @param $brand_id
* @param $time
* @return int
*/
public function get_cps_type($brand_id, $time = 0)
{
$cps_type = self::CPS_TYPE_OTHER;
!$time && $time = time();
if ($brand_id) {
$where = [
'brand_id' => $brand_id,
's_time<=' => date('Y-m-d', $time),
'e_time>=' => date('Y-m-d', $time),
'status' => Sys_cps_model::STATUS_NORMAL,
];
$row = $this->sys_cps_model->get($where);
if ($row) {
$cps_type = $row['type'];
}
}
return $cps_type;
}
}