Files
liche/common/models/topics/Topic_module_enroll_model.php
2021-08-02 11:44:52 +08:00

82 lines
1.9 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Notes:专题模块-报名表
* Created on: 2020/5/14 13:46
* Created by: dengbw
*/
class Topic_module_enroll_model extends HD_Model
{
private $table_name = 'lc_topic_module_enroll';
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
/**
* 数量
* @param array $where
* @param string $distinct
* @return mixed
*/
function count_status($where = array(), $distinct = ''){
$this->db->from("hd_topic_module_enroll as m");
$this->db->join("hd_topic_modules as j", "j.id=m.module_id and j.type='enroll'", 'left');
if($where)
{
$this->db->where($where);
}
if($distinct)
{
$this->db->distinct();
$this->db->select($distinct, false);
}
return $this->db->count_all_results();
}
/**
* @param array $where
* @param string $order
* @param int $page
* @param int $page_size
* @param string $select
* @return mixed
*/
function select_status($where = array(), $order = '', $page = 0, $page_size = 20, $select = ''){
$this->db->from("hd_topic_module_enroll as m");
$this->db->join("hd_topic_modules as j", "j.id=m.module_id and j.type='enroll'", 'left');
if($select)
{
$this->db->select($select, false);
}
if($where)
{
$this->db->where($where);
}
if($order)
{
$this->db->order_by($order);
}
if($page)
{
$offset = ($page - 1) * $page_size;
$limit = $page_size;
}
else
{
$offset = null;
$limit = null;
}
return $this->db->get(null, $limit, $offset)->result_array();
}
}