public function index() { $type = $_GET['type']; if (!empty($type)) { $url_type = '-type-' . $type; if ($type == 'no') { $where = 'type is Null'; } else { $where = 'type="' . $type . '"'; } } $ext = intval($_GET['ext']); if (!empty($ext)) { $ext1 = '"jpg","gif","jpeg","bmp","png"'; $ext2 = '"flv","wmv","wma","mp3","jpeg","mp4","3gp","avi","swf","mkv"'; $ext3 = '"doc","xsl","wps","docx","xslx","ppt","pptx"'; $ext4 = '"zip","rar","7z"'; $ext5 = $ext1 . ',' . $ext2 . ',' . $ext3 . ',' . $ext4; $url_ext = '-ext-' . $ext; switch ($ext) { case 1: $where = 'ext in(' . $ext1 . ')'; break; case 2: $where = 'ext in(' . $ext2 . ')'; break; case 3: $where = 'ext in(' . $ext3 . ')'; break; case 4: $where = 'ext in(' . $ext4 . ')'; break; case 5: $where = 'ext not in(' . $ext5 . ')'; break; } } $search = in(urldecode($_GET['search'])); if (!empty($search)) { $where = ' title like "%' . $search . '%"'; $url_search = '-search-' . $search; } //分页处理 //分页信息 $url = __URL__ . '/index/page-{page}' . $url_type . $url_ext . $url_search; //分页基准网址 $listRows = 50; $page = new Page(); $cur_page = $page->getCurPage($url); $limit_start = ($cur_page - 1) * $listRows; $limit = $limit_start . ',' . $listRows; //内容列表 $this->list = model('upload')->file_list($where, $limit); //统计总内容数量 $count = model('upload')->count($where); $this->assign('page', $this->page($url, $count, $listRows)); $this->module_list = model('upload')->module_list(); $this->show(); }
public function get_user_super($url, $school, $cid, $ex_d = '', $pr_d = '') { $con = 's_id=' . $school . ' and c_id=' . $cid; if (!empty($ex_d) and !empty($pr_d)) { $con .= ' and reg_time >=\'' . $ex_d . '\' and reg_time <=\'' . $pr_d . '\''; } $page = new Page(); $listRows = 15; //产品每页显示的信息条数 // $url=__URL__.'?p={page}';//分页基准网址 $cur_page = $page->getCurPage($url); $limit_start = ($cur_page - 1) * $listRows; $limit = $limit_start . ',' . $listRows; $field1 = 'p_id'; $count = $this->model->table($this->config['info_person'])->field($field1)->where($con)->count(); $page = $page->show($url, $count, $listRows); $field = 'addr, name, phone, s_name, c_name, point, reg_time'; $res = $this->model->table($this->config['info_person'])->field($field)->where($con)->limit($limit)->order('DATE_FORMAT(reg_time, \'%Y-%m-%d\') asc, addr asc')->select(); return array('info' => $res, 'page' => $page); }
/** * 获取此管理员所有空桶情况 * @param a_id 销售员在本系统的 id 编号 * @param addr 若为 0, 表示获取所有宿舍,若为 其它表示某宿舍楼 */ public function get_bucket($a_id, $url, $school, $cid = 0, $addr = 0) { $con = 'a_id=' . $a_id; if ($school > 0) { $con .= ' and s_id = ' . $school . ' and c_id=' . $cid; } if ($addr > 0) { $con .= ' and addr like \'' . $addr . '-%\''; } $page = new Page(); $listRows = 15; //产品每页显示的信息条数 // $url=__URL__.'?p={page}';//分页基准网址 $cur_page = $page->getCurPage($url); $limit_start = ($cur_page - 1) * $listRows; $limit = $limit_start . ',' . $listRows; $field1 = 'id'; $count = $this->model->table('dormit_water')->field($field1)->where($con)->count(); $page = $page->show($url, $count, $listRows); $field = 'id, s_name, addr, wait_recyle, status, update_time'; $res = $this->model->table('dormit_water')->field($field)->where($con)->limit($limit)->order('addr desc')->select(); return array('info' => $res, 'page' => $page); }
/** * 用于查询用户订单,读取数据库,获取相关信息 * @param p_id 表示此用户在本系统的 id 编号 * @param url 分页基准网址 */ public function get_info_order_mysql($p_id, $url) { $con = 'p_id =' . $p_id; $field = 'created, g_name, num, total_fee, pay_type, consume_points'; $page = new Page(); $listRows = 10; //产品每页显示的信息条数 // $url=__URL__.'?p={page}';//分页基准网址 $cur_page = $page->getCurPage($url); $limit_start = ($cur_page - 1) * $listRows; $limit = $limit_start . ',' . $listRows; $count = $this->model->table($this->config['order'])->where($con)->count(); $res = $this->model->table($this->config['order'])->field($field)->where($con)->order('created desc')->limit($limit)->select(); if ($res) { return array('data' => $res, 'page' => $page->show($url, $count, $listRows)); } else { return False; } }
/** * 获取所有经销商的订单 * @param a_id 销售员在本系统的 id 编号 */ public function get_order_super($url, $status = -1, $school = 0, $cid = 0, $aid = 0, $ex_d = '', $pr_d = '') { $con = 's_id=' . $school . ' and c_id=' . $cid; if ($aid > 0) { $con .= ' and a_id=' . $aid; } if ($status != -1) { $con .= ' and send_status =' . $status; } if (!empty($ex_d) and !empty($pr_d)) { $con .= ' and created >=\'' . $ex_d . '\' and created <=\'' . $pr_d . '\''; } $page = new Page(); $listRows = 15; //产品每页显示的信息条数 // $url=__URL__.'?p={page}';//分页基准网址 $cur_page = $page->getCurPage($url); $limit_start = ($cur_page - 1) * $listRows; $limit = $limit_start . ',' . $listRows; $field1 = 'o_id'; $count = $this->model->table($this->config['order'])->field($field1)->where($con)->count(); $page = $page->show($url, $count, $listRows); $field = 'addr, name, phone, created, s_name, c_name, g_name, num, pay_type, send_status'; $res = $this->model->table($this->config['order'])->field($field)->where($con)->limit($limit)->order('DATE_FORMAT(created, \'%Y-%m-%d\') asc, addr asc')->select(); return array('info' => $res, 'page' => $page); }
protected function pagelimit($url, $listRows) { $page = new Page(); $cur_page = $page->getCurPage($url); $limit_start = ($cur_page - 1) * $listRows; return $limit_start . ',' . $listRows; }