Files
liche/common/models/receiver/order/Receiver_orders_model.php
T
2021-07-22 15:46:18 +08:00

80 lines
2.2 KiB
PHP

<?php
/**
* Created by Vim
* User: lcc
* Date: 2021/07/09
* Time: 13:47
*/
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 => '申请开票',4=>'代理服务',5 => '交付确认', 6 => '完成交付', 7 => '申请退款'];
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
public function get_step($mobile){
$t1 = 'lc_receiver_orders';
//$t2 = 'lc_receiver_order_contracts';
$this->db->select("$t1.*");
$this->db->from($t1);
//$this->db->join($t2, "$t2.o_id = $t1.id and $t2.type=3",'left');
//$where = [
// "$t1.mobile" => $mobile,
// "($t2.status<1 or $t2.status is null)" => null
//];
$where = [
"$t1.mobile" => $mobile,
"$t1.status<" => 6
];
$this->db->where($where);
$this->db->order_by("$t1.id desc");
$this->db->limit(1);
$row = $this->db->get()->row_array();
return $row;
}
//获取交车列表
public function get_finsh($mobile,$page,$size,$count){
$t1 = 'lc_receiver_orders';
//$t2 = 'lc_receiver_order_contracts';
$this->db->select("$t1.*");
$this->db->from($t1);
//$this->db->join($t2, "$t2.o_id = $t1.id and $t2.type=3",'left');
//$where = [
// "$t1.mobile" => $mobile,
// "$t2.status" => 1,
//];
$where = [
"$t1.mobile" => $mobile,
"$t1.status" => 6,
];
$this->db->where($where);
if($count){
return $this->db->count_all_results();
}
$this->db->order_by("$t1.id desc");
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();
}
public function get_status(){
return $this->status_arr;
}
}