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(); } }