50 lines
1.3 KiB
PHP
50 lines
1.3 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
/**
|
|
* Notes:门店素材统计表
|
|
* Created on: 2021/10/11 12:45
|
|
* Created by: dengbw
|
|
*/
|
|
class Material_biz_statistics_model extends HD_Model
|
|
{
|
|
private $table_name = 'lc_material_biz_statistics';
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct($this->table_name, 'default');
|
|
}
|
|
|
|
//关联订单
|
|
public function count_order($where)
|
|
{
|
|
return $this->select_order($where, 'o.rid', '', '', '', 1);
|
|
}
|
|
|
|
public function select_order($where = array(), $order = '', $page = 0, $page_size = 20, $fileds = '', $count = 0)
|
|
{
|
|
!$fileds && $fileds = 'o.*';
|
|
$this->db->select($fileds);
|
|
$this->db->from('lc_receiver_orders as o');
|
|
$this->db->join('lc_receiver_customers as c', 'c.id = o.rid', '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();
|
|
}
|
|
}
|