*/ class DateController extends AdminController { /** * 约会管理首页 * @author 麦当苗儿 <*****@*****.**> */ public function index() { $status = I('status'); $uid = I('uid'); if ($uid) { $map['uid'] = $uid; } else { $map['uid'] = array('neq', 0); } if ($status && in_array($status, array(1, 2, 3))) { $map['status'] = 1; } else { $map['status'] = array('neq', -1); } $map['cid'] = array('neq', 0); $count = M('user_date')->where($map)->count(); $page = new \Think\Page($count, 10); $list = M('user_date')->where($map)->order('create_time desc')->limit($page->firstRow, $page->listRows)->select(); foreach ($list as $key => $v) { $list[$key]['user'] = $this->getUserNickname($v['uid']); $list[$key]['typename'] = $this->getTypeName($v['cid']);
public function index() { //取出用户信息 $User = D('UserRelation'); $searchName = I('search'); if ($searchName !== "") { $count = $User->field('password', true)->relation(true)->where(array('user_name' => $searchName))->count(); $Page = new \Think\Page($count, 7); // 实例化分页类 $list = $User->field('password', true)->relation(true)->limit($Page->firstRow . ',' . $Page->listRows)->where(array('user_name' => $searchName))->select(); } else { $count = $User->field('password', true)->relation(true)->count(); $Page = new \Think\Page($count, 7); // 实例化分页类 $list = $User->field('password', true)->relation(true)->limit($Page->firstRow . ',' . $Page->listRows)->select(); } $show = $Page->show(); // 分页显示输出 $this->assign('user', $list); // 赋值数据集 $this->assign('page', $show); // 赋值分页输出 //取出与用户有关的部门信息和职位信息 $apart = M('apart_user')->select(); $level = M('level_user')->select(); $this->assign('apart', $apart); $this->assign('level', $level); $this->display(); }
/** * 友情链接列表 * @date: 2016-2-4 上午07:21:35 * @author: zhouqg * @param: variable * @return: */ public function index() { // 搜索功能 $keyword = I('post.keyword'); if (!empty($keyword)) { $where['link_name'] = array('like', "%{$keyword}%"); $this->assign('keyword', $keyword); } $m = D('Link'); $order = 'link_sort,link_addtime desc'; $result = $m->where($where)->select(); //分页 $count = count($result); // 查询满足要求的总记录数 $Page = new \Think\Page($count, 15); // 实例化分页类 传入总记录数和每页显示的记录数(20) $show = $Page->show(); // 分页显示输出 $this->assign('page', $show); // 赋值分页输出 $this->assign('count', $count); // 赋值分页输出 $result = $m->where($where)->order($order)->limit($Page->firstRow . ',' . $Page->listRows)->select(); $this->assign('vlist', $result); //赋值 $this->display(); }
public function index() { $user = session('auth_manager_shop'); //载入分类 $catelist = D('GoodsCate')->get_cate_list(0); $this->assign('catelist', $catelist); //当前分类id $_GET['cate_id'] = $_GET['cate_id'] ? $_GET['cate_id'] : 0; $this->assign('cate_id', $_GET['cate_id']); $ids = D('GoodsCate')->get_child_ids($_GET['cate_id']); //分页 $Goods = M('Goods'); $where['pid'] = array('in', $ids); $where['sid'] = $user['shopid']; $count = $Goods->where($where)->count(); $Page = new \Think\Page($count, 30); $show = $Page->show(); //主数据 $alist = $Goods->where($where)->field(true)->order('id desc')->limit($Page->firstRow . ',' . $Page->listRows)->select(); foreach ($alist as &$v) { $v['mainpic'] = json_decode($v['mainpic'], true)[1]; } $this->assign('alist', $alist); $this->assign('pages', $show); $this->display(); }
public function getSon() { $id = $_GET['id']; $son = M('category'); $total = $son->where('form_id=' . $id)->count(); $page = new \Think\Page($total, 5); $button = $page->show(); $sonlist = $son->where('form_id=' . $id)->limit($page->firstRow . ',' . $page->listRows)->select(); $parent = $son->where('id=' . $sonlist[0]['form_id'])->select(); $this->assign('page', $button); foreach ($sonlist as &$val) { if ($val['display'] == 1) { $val['display'] = '已启用'; } elseif ($val['display'] == 0) { $val['display'] = '已禁用'; } if ($val['path'] == '0,') { $val['gpath'] = $val['path']; $val['path'] = '根目录'; } else { $val['gpath'] = $val['path']; $val['path'] = "/{$parent[0]['name']}/{$val['name']}"; } } $this->assign('list', $sonlist); $this->display('categorylist'); }
public function join() { $this->title = '我参与的'; $this->user = M('user')->find($this->user_id); $page = I('request.p', 1); $page = $page < 1 ? 1 : $page; $list = M('hongbao_order')->where(array('user_id' => $this->user_id))->page($page, 10)->order("id DESC")->select(); if ($list) { foreach ($list as $i => $item) { $list[$i]['hongbao'] = M('hongbao')->find($item['hongbao_id']); $list[$i]['user'] = M('user')->find($list[$i]['hongbao']['user_id']); } } $total = M('hongbao_order')->where(array('user_id' => $this->user_id))->count(); $this->list = $list; $Page = new \Think\Page($total, 10); // 实例化分页类 传入总记录数和每页显示的记录数(20) $Page->rollPage = 5; $Page->setConfig('prev', '上一页'); $Page->setConfig('next', '下一页'); $Page->setConfig('theme', '%UP_PAGE% %DOWN_PAGE% <li ><a>共 %TOTAL_ROW% 条记录</a></li>'); $show = $Page->show(); $this->page = $show; $this->display(); }
public function orderList() { $Data = M('Company_order'); $opt = I('post.'); $city = session($this->_userCfg['CITY']); if ($city != '') { $opt['city'] = $city; } $count = $Data->where($opt)->count(); // 查询满足要求的总记录数 $map表示查询条件 $page = new \Think\Page($count, 15); // 实例化分页类 传入总记录数 $show = $page->show(); // 分页显示输出 // 进行分页数据查询 $order = $Data->where($opt)->order('addTime desc')->limit($page->firstRow . ',' . $page->listRows)->select(); if ($order) { for ($i = 0; $i < count($order); $i++) { $order[$i]['payType'] = $this->getPayType($order[$i]['payType']); $order[$i]['paySign'] = $this->getPaySign($order[$i]['payTime']); $order[$i]['wlSign'] = $this->getWlSign($order[$i]['sign']); $order[$i]['userInfo'] = unserialize($order[$i]['address']); } } $this->assign('page', $show); // 赋值分页输出 $this->assign('order', $order); $this->assign('params', $opt); $this->display(); }
public function search() { // 搜索功能 $role_name = I('get.role_name'); if ($role_name) { $where['role_name'] = array('like', "%{$role_name}%"); } // 分页功能 $count = $this->where($where)->count(); $page = new \Think\Page($count, 2); $show = $page->show(); /* 取出所有的角色及其对应的权限 Mysql>select a.*, group_concat(c.pri_name) as pri_list from jj_role a left join jj_role_privilige b on a.id=b.role_id left join jj_privilige c on b.pri_id = c.id group by id; === +----+-------------+------------------------------------------------------------------+ | id | role_name | pri_list | +----+-------------+------------------------------------------------------------------+ | 4 | test-角色 | 商品分类,添加分类,商品列表,商品移除,商品添加 | | 5 | 测试2 | 商品列表,商品移除,商品添加 | +----+-------------+------------------------------------------------------------------+ */ // 在thinkPHP中构造出上面的语句 $data = $this->field('a.*,GROUP_CONCAT(c.pri_name) as role_priviliges')->alias('a')->join('left join jj_role_privilige b on a.id=b.role_id left join jj_privilige c on b.pri_id = c.id')->where($where)->group('a.id')->limit($page->firstRow . ',' . $page->listRows)->select(); return array('showpagecode' => $show, 'data' => $data); }
public function admin() { /* $cate=D('Category'); $count=$cate->field('id')->count(); $page = new \Think\Page($count,3); // $page->setConfig('header','个会员'); $show = $page->show();// 分页显示输出 $list = $cate->limit($page->firstRow.','.$page->listRows)->select(); $this->assign('list',$list);// 赋值数据集 $this->assign('show',$show);// 赋值分页页脚输出 $this->display(); // 输出模板 */ //需要实例化基类(或者未字段映射) $cate = M('Category'); $list = $cate->field(true)->page($_GET['p'], 3)->select(); $this->assign('list', $list); // 赋值数据集 $count = $cate->field(true)->count(); // 查询满足要求的总记录数 $Page = new \Think\Page($count, 3); // 实例化分页类 传入总记录数和每页显示的记录数 $show = $Page->show(); // 分页显示输出 $this->assign('show', $show); // 赋值分页输出 $this->display(); // 输出模板 }
public function index() { //礼包列表 $this->meta_title = '微信列表'; $weixinreplaymodel = M('weixinreplay'); $count = $weixinreplaymodel->count(); // 查询满足要求的总记录数 $Page = new \Think\Page($count, 15); // 实例化分页类 传入总记录数和每页显示的记录数(25) $show = $Page->show(); // 分页显示输出 $list = $weixinreplaymodel->limit($Page->firstRow . ',' . $Page->listRows)->select(); foreach ($list as $k => $v) { switch ($v['eventtype']) { case '0': $list[$k]['eventname'] = '一般回复'; break; case '1': $list[$k]['eventname'] = '默认回复'; break; case '2': $list[$k]['eventname'] = '关注回复 '; break; default: $list[$k]['eventname'] = '未知'; } } $this->assign('list', $list); // 赋值数据集 $this->assign('page', $show); // 赋值分页输出 $this->display(); }
public function search($pageSize = 20) { /**************************************** 搜索 ****************************************/ $where = array(); if ($attr_name = I('get.attr_name')) { $where['attr_name'] = array('like', "%{$attr_name}%"); } if ($attr_type = I('get.attr_type')) { $where['attr_type'] = array('eq', $attr_type); } if ($attr_option_values = I('get.attr_option_values')) { $where['attr_option_values'] = array('like', "%{$attr_option_values}%"); } if ($type_id = I('get.type_id')) { $where['type_id'] = array('eq', $type_id); } /************************************* 翻页 ****************************************/ $count = $this->alias('a')->where($where)->count(); $page = new \Think\Page($count, $pageSize); // 配置翻页的样式 $page->setConfig('prev', '上一页'); $page->setConfig('next', '下一页'); $data['page'] = $page->show(); /************************************** 取数据 ******************************************/ $data['data'] = $this->alias('a')->where($where)->group('a.id')->limit($page->firstRow . ',' . $page->listRows)->select(); return $data; }
/** * 平论首页 */ public function commentInfo() { $type = 1; if (isset($_GET['type']) && $_GET['type'] != '') { $type = $_GET['type']; } if (isset($_GET['message']) && $_GET['message'] != '') { $where['a.message'] = array('like', '%' . $_GET['message'] . '%'); } if (isset($_GET['userName']) && $_GET['userName'] != '') { $where['m.userName'] = array('like', '%' . $_GET['userName'] . '%'); } if (isset($_GET['is_del']) && $_GET['is_del'] != 'all') { if ($_GET['is_del'] == 1) { $where['is_del'] = 1; } else { $where['is_del'] = 0; } } $where['a.type'] = 1; if ($type == 1) { //评论 $model = M('comment'); } else { //回复 $model = M('comment_reply'); } $count = $model->alias('a')->join('left join ybirds_member as m on m.uid=a.uid')->where($where)->count(); $page = new \Think\Page($count, 20); $pageShow = $page->show(); $info = $model->alias('a')->field('a.id,m.userName,a.did,a.postTime,a.is_see,a.is_del,a.message')->join('left join ybirds_member as m on m.uid=a.uid')->where($where)->order('postTime desc')->limit($page->firstRow . ',' . $page->listRows)->select(); $this->assign('info', $info); $this->assign('page', $pageShow); $this->display(); }
public function index() { $id = I('get.id'); if ($id == null) { $node = D('Node')->getnode(); $this->assign('node', $node); } else { $nodeinfo = D('Node')->nodeinfo($id); if (!$nodeinfo) { $this->error("没有该节点"); } //node列表 $article = M('Article'); $count = $article->where(array("status" => 0, "nodeid" => $id))->count(); $page = new \Think\Page($count, 10); $show = $page->show(); $list = $article->where(array("status" => 0, "nodeid" => $id))->order('lasttime DESC')->limit($page->firstRow . ', ' . $page->listRows)->getField('id,title,username,userid,creattime,lasttime,review,node,nodeid'); foreach ($list as $arr) { $image = M('Userinfo')->where("id = '%d'", $arr['userid'])->getField('image'); $arr['image'] = $image; $data[] = $arr; } $this->assign('nodeinfo', $nodeinfo); $this->assign('list', $data); $this->assign('page', $show); } $this->display(); }
public function lineAction() { header("Content-Type:text/html; charset=UTF-8"); $res = $this->achievementAction(10000); $rebate = D('Rebate'); $key = 1; $res = $rebate->init($key); $Page = new \Think\Page(count($res), 10); // 实例化分页类 传入总记录数和每页显示的 $Page->setConfig('theme', '%FIRST% %UP_PAGE% %HEADER% %DOWN_PAGE% %END%'); $Page->setConfig('header', '<span class="rows">共 %TOTAL_ROW% 个返点</span>%LINK_PAGE%<span class="currentrows">当前第 %NOW_PAGE% 页</span>'); $show = $Page->show(); // 分页显示输出 $this->assign('page', $show); // 赋值分页输出 foreach ($res as $key => $value) { $res[$key]['actionUrl']['edit'] = U('Rebate/Edit/line?id=' . $value['id']); $res[$key]['actionUrl']['delete'] = U('Rebate/Delete/line?id=' . $value['id']); } $this->assign('rebate', $res); $this->assign('urlAdd', U('Rebate/Add/line')); $TPL = T('Rebate@Index/index'); $this->assign('YZRight', $this->fetch($TPl)); $this->display(YZ_TEMPLATE); }
public function lst() { //实例化模型 $brandModel = D('brand'); /*****************设置数字签名*****************/ //1 设置数字签名,加盐拼接id $md5String = md5(C('SALT')); /*****************分页功能*****************/ //1 获取记录总数 $count = $brandModel->count(); //2 获取每页显示的数量 $pageNum = C('PAGE_NUMBER'); //3 实例化分页类 $Page = new \Think\Page($count, $pageNum); //4 获取分页栏 $show = $Page->show(); //5 分页数据的获取 $data = $brandModel->limit($Page->firstRow . ',' . $Page->listRows)->select(); /*****************分配数据,显示模板*****************/ $this->assign('data', $data); $this->assign('show', $show); $this->assign('md5String', $md5String); //分配数字签名 $this->display('brand_list'); }
public function index() { $article = D("Article"); //实例化文章类 $user = D('User'); //实例化用户表 /*姓名判断*/ if (I('get.user')) { $name = I('get.user'); $map['name'] = array('exp', "like '%{$name}%' "); $ulist = $user->where($map)->select(); $name = ''; foreach ($ulist as $key => $value) { $name[$key] = $value['id']; } $where = join(" or 'user_id' = ", $name); $map['user_id'] = $where; unset($map['name']); } /*标题判断*/ if (I('get.title')) { $title = I('get.title'); $map['title'] = array('exp', "like '%{$title}%' "); } $total = $article->where($map)->count(); $page = new \Think\Page($total, 8); //$artlist=$article->field('id,title,user_id,cate_id,dis,time')->select(); $artlist = $article->field('id,title,user_id,cate_id,dis,time')->where($map)->limit($page->firstRow . ',' . $page->listRows)->getArt(); $pageButton = $page->show(); //dump($artlist); $this->assign('list', $artlist); $this->assign('pageButton', $pageButton); $this->display(); }
public function index() { $map = array(); $parameter = array(); if (!empty($_REQUEST['brand'])) { $map['brandtitle'] = array('like', '%' . $_REQUEST['brand'] . '%'); $parameter['brand'] = $_REQUEST['brand']; } if (!empty($_REQUEST['series'])) { $map['seriestitle'] = array('like', '%' . $_REQUEST['series'] . '%'); $parameter['series'] = $_REQUEST['series']; } if (!empty($_REQUEST['keywords'])) { $map['title'] = array('like', '%' . $_REQUEST['keywords'] . '%'); $parameter['title'] = $_REQUEST['keywords']; } $model = D('CarClassView'); $count = $model->where($map)->count(); $page = new \Think\Page($count, 15); $page->parameter = array_merge($parameter, $page->parameter); $show = $page->show(); $list = $model->where($map)->order('sort desc')->limit($page->firstRow . ',' . $page->listRows)->select(); cookie('_currentUrl_', __SELF__); $this->assign(array('list' => $list, 'page' => $show)); $this->display(); }
public function admin_list() { $admin = M('admin'); $val = I('val'); $auth = new Auth(); $this->assign('testval', $val); if ($val) { $map['admin_username'] = array('like', "%" . $val . "%"); } $count = $admin->where($map)->count(); // 查询满足要求的总记录数 $Page = new \Think\Page($count, C('DB_PAGENUM')); // 实例化分页类 传入总记录数和每页显示的记录数 foreach ($map as $key => $val) { $Page->parameter[$key] = urlencode($val); } $show = $Page->show(); // 分页显示输出 $admin_list = $admin->where($map)->order('admin_id')->limit($Page->firstRow . ',' . $Page->listRows)->select(); foreach ($admin_list as $k => $v) { $group = $auth->getGroups($v['admin_id']); $admin_list[$k]['group'] = $group[0]['title']; } $this->assign('admin_list', $admin_list); $this->assign('page', $show); $this->display(); }
public function adList() { $m = M('Company_ad'); if (session($this->_userCfg['ECID']) != '816') { $opt['ecid'] = session($this->_userCfg['ECID']); } else { $admin = session($this->_userCfg['ECID']); } if (I('post.ecid') != '' && I('post.ecid') != '-1') { $opt['ecid'] = I('post.ecid'); } if (I('post.id') != '' && I('post.id') != "-1") { $opt['id'] = I('post.id'); } $count = $m->where($opt)->count(); // 查询满足要求的总记录数 $map表示查询条件 $page = new \Think\Page($count, 10); // 实例化分页类 传入总记录数 $show = $page->show(); // 分页显示输出 $result = $m->where($opt)->order('modifyTime desc')->limit($page->firstRow . ',' . $page->listRows)->select(); $this->assign('admin', $admin); $this->assign('adInfo', $result); $this->assign('page', $show); // 赋值分页输出 $this->display(); }
public function index() { //dump($_SESSION); //实例化对象 $user = M('user'); //获得用户的信息 $username = I('username'); //判断是否提交了搜索 if ($_POST) { $_GET['p'] = 1; } if (isset($_SESSION['help']['fk'])) { $_GET['p'] = 1; unset($_SESSION['help']['fk']); } $args['username'] = $username; //模糊查询 $map['username'] = array("LIKE", "%{$username}%"); //获得满足条件的总记录数 $count = $user->where($map)->count(); //实例化分页类,传入总条数、每页显示条数 $Page = new \Think\Page($count, 3, $args); //查询用户信息 $data = $user->field('id,username,password,auth,status,regtime')->where($map)->limit("{$Page->firstRow},{$Page->listRows}")->order("id asc")->select(); //显示分页 $show = $Page->show(); //分配数据 $this->assign('Page', $show); $this->assign('users', $data); $this->display(); }
/** * */ public function queryView($map = null, $page = array('curpage' => 0, 'size' => 10), $order = false, $params = false, $fields = false) { $query = $this->model; if (!is_null($map)) { $query = $query->where($map); } if (!($order === false)) { $query = $query->order($order); } if (!($fields === false)) { $query = $query->field($fields); } $list = $query->page($page['curpage'] . ',' . $page['size'])->alias('a')->join('common_member b on a.uid=b.uid')->join('itboye_mgroup c on a.groupid=c.id')->field('a.id id,b.nickname nickname,c.name,c.discount_ratio,c.commission_ratio,a.createtime')->select(); if ($list === false) { $error = $this->model->getDbError(); return $this->apiReturnErr($error); } $count = $this->model->where($map)->count(); // 查询满足要求的总记录数 $Page = new \Think\Page($count, $page['size']); //分页跳转的时候保证查询条件 if ($params !== false) { foreach ($params as $key => $val) { $Page->parameter[$key] = urlencode($val); } } // 实例化分页类 传入总记录数和每页显示的记录数 $show = $Page->show(); return $this->apiReturnSuc(array("show" => $show, "list" => $list)); }
public function index() { //初始化参数 $where = ''; //接收搜索框传值 $username = I('get.username'); //如果不为空则设置查询条件 if (!empty($username)) { $where['username'] = array('like', '%' . $username . '%'); } //创建连接数据库对象 $user = M('users'); //统计总记录数 $count = $user->where($where)->count(); //创建分页对象 $pages = new \Think\Page($count, 10); //获取页码 $page = $pages->show(); //获取limit参数 $limit = $pages->firstRow . ',' . $pages->listRows; //读数据 $users = $user->limit($limit)->where($where)->order('id ASC')->select(); //分配变量 $this->assign('users', $users); $this->assign('page', $page); $this->assign('username', $username); //解析模版 $this->display(); }
public function index(){ $id = I('get.id'); //$list=M('article')->where(array('cid'=>$id))->limit()->select(); $Blog=M('article'); $count = $Blog->count(); $Page =new \Think\Page($count,C('LISTPAGESIZE')); $list=$Blog->where(array('cid'=>$id))->limit($Page->firstRow.','.$Page->listRows)->select(); $show = $Page->show(); $this->assign('page',$show); $field= array('cname'); $cate=M('category')->field($field)->find($id); $this->cate=$cate; $this->list=$list; //S('List',$list,10); $this->display('/list'); }
/** * history() * 打印店历史文件列表 * @param $pri_id */ public function history() { $pid = pri_id(U('Index/index')); if ($pid) { $condition['pri_id'] = $pid; $status = 5; $condition['status'] = $status; $this->assign('history', true); $this->title = '已打印文件历史记录'; $File = D('FileView'); $count = $File->where($condition)->count(); $Page = new \Think\Page($count, 10); $show = $Page->show(); $ppt_layout = C('PPT_LAYOUT'); $result = $File->where($condition)->order('file.id desc')->limit($Page->firstRow . ',' . $Page->listRows)->select(); //cache($cache_key, 10)->select(); foreach ($result as &$file) { $file['ppt_layout'] = $ppt_layout[$file['ppt_layout']]; } unset($file); $this->data = $result; $this->assign('page', $show); $this->display(); } else { $this->redirect('Printer/Index/index'); } }
public function search($pageSize = 20) { /**************************************** 搜索 ****************************************/ $where = array(); if ($brand_name = I('get.brand_name')) { $where['brand_name'] = array('like', "%{$brand_name}%"); } if ($site_url = I('get.site_url')) { $where['site_url'] = array('like', "%{$site_url}%"); } if ($goods_desc = I('get.goods_desc')) { $where['goods_desc'] = array('eq', $goods_desc); } if ($sort = I('get.sort')) { $where['sort'] = array('eq', $sort); } if ($is_show = I('get.is_show')) { $where['is_show'] = array('eq', $is_show); } /************************************* 翻页 ****************************************/ $count = $this->alias('a')->where($where)->count(); $page = new \Think\Page($count, $pageSize); // 配置翻页的样式 $page->setConfig('prev', '上一页'); $page->setConfig('next', '下一页'); $data['page'] = $page->show(); /************************************** 取数据 ******************************************/ $data['data'] = $this->alias('a')->where($where)->group('a.id')->limit($page->firstRow . ',' . $page->listRows)->select(); return $data; }
/** * 信息审核页面 */ public function index() { $searchName = I('search'); if ($searchName !== "") { //按nickname查询 $where['check_state'] = 0; $where['pro_name'] = array('like', '%' . $searchName . '%'); $count = M('product_list')->where($where)->count(); $Page = new \Think\Page($count, 10); // 实例化分页类 $show = $Page->show(); // 分页显示输出 $list = M('product_list')->limit($Page->firstRow . ',' . $Page->listRows)->where($where)->select(); } else { $count = M('product_list')->where('check_state = 0')->count(); $Page = new \Think\Page($count, 10); // 实例化分页类 $show = $Page->show(); // 分页显示输出 $list = D('product_list')->where('check_state = 0')->limit($Page->firstRow . ',' . $Page->listRows)->select(); } $this->assign('list', getList($list)); // 赋值数据集 $this->assign('show', $show); // 赋值分页输出 $this->display(); }
public function index() { //实例化user模型 $user = D('Common/User'); //接收参数 $mobile = I('mobile'); $username = I('username'); $page = I('p') ?: 1; $where = array(); if (!empty($mobile)) { $where['tel'] = array('like', $mobile); } if (!empty($username)) { $where['name'] = array('like', $username); } //数据查询 $limit = 10; $offset = ($page - 1) * $limit; $user_list = $user->user_lists('', $limit, $offset, $where); $all_count = $user->user_count(); //构造分页 $page = new \Think\Page($all_count, $limit); $page_str = $page->show(); $this->assign('user_list', $user_list); $this->assign('page', $page_str); $this->display(); }
public function index() { //遍历循环搜索条件 foreach ($_GET as $k => $v) { if ($v) { $map[$k] = $v; } } unset($map['p']); $attrvalue = M("attrvalue"); $count = $attrvalue->where($map)->count(); //查询数据总条数 $data = $attrvalue->where($map)->order("sort ASC")->page($_GET['p'], 10)->select(); //获取属性数据 $Page = new \Think\Page($count, 10, $map); //给分页类传入搜索条件,维持搜索 $show = $Page->show(); //分页显示输出 /* //获取商品类型 $types = M("type") -> field('id,name,pid') -> select(); $types = getList($types); foreach($types as $v){ $type[$v['id']] = $v['name'];//定义数组存放类型,键为ID,值为类名 } */ $this->assign('map', $map); $this->assign('page', $show); //$this -> assign('types',$types); //$this -> assign('type',$type); $this->assign('attrvalues', $data); $this->display(); }
public function index() { $opus = D('Opus'); //实例化问题表 $user = D('User'); //实例化用户表 //dump(I('get.')); /*姓名判断*/ if (I('get.user')) { $name = I('get.user'); $map['name'] = array('exp', "like '%{$name}%' "); $ulist = $user->where($map)->select(); $name = ''; foreach ($ulist as $key => $value) { $name[$key] = $value['id']; } $where = join(" or 'user_id' = ", $name); $map['user_id'] = $where; unset($map['name']); } /*标题判断*/ if (I('get.title')) { $title = I('get.title'); $map['ques'] = array('exp', "like '%{$title}%' "); } $total = $opus->where($map)->count(); $page = new \Think\Page($total, 8); $oplist = $opus->where($map)->limit($page->firstRow . ',' . $page->listRows)->getOpus(); $pageButton = $page->show(); //dump($oplist); $this->assign('list', $oplist); $this->assign('pageButton', $pageButton); $this->display(); }
public function index() { if (IS_POST) { $map = array(); if (!empty($_POST['keywords'])) { $map['title'] = array('like', '%' . $_POST['keywords'] . '%'); } if (isset($_POST['property'])) { switch ($_POST['property']) { case 'is_red': $map['is_red'] = 1; break; case 'is_hot': $map['is_hot'] = 1; break; case 'is_lock': $map['is_lock'] = 1; break; default: break; } } } $model = M('CarBrand'); $count = $model->where($map)->count('id'); $page = new \Think\Page($count, 15); $show = $page->show(); $list = $model->where($map)->order('letter asc, sort desc')->limit($page->firstRow . ',' . $page->listRows)->select(); cookie('_currentUrl_', __SELF__); $this->assign(array('list' => $list, 'page' => $show, 'map' => $map, 'count' => $count)); $this->display(); }