Files
spacestation/common/models/receiver/Receiver_customers_visit_data_model.php
2024-05-28 14:43:08 +08:00

51 lines
1.4 KiB
PHP

<?php
/**
* Notes:客户回访记录
* Created on: 2022/05/23 17:15
* Created by: dengbw
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Receiver_customers_visit_data_model extends HD_Model
{
private $table_name = 'lc_receiver_customer_visit_data';
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
//关联客户待回访
public function count_visit($where)
{
return $this->select_visit($where, '', '', '', '', 1);
}
public function select_visit($where = array(), $order = '', $page = 0, $page_size = 20, $fileds = '', $count = 0)
{
!$fileds && $fileds = 'a.*';
$this->db->select($fileds);
$this->db->from('lc_receiver_customers as a');
$this->db->join('lc_receiver_customer_visit_data as b', 'b.c_id = a.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();
}
}