Esempio n. 1
0
 public function getPageResult($wheres = array())
 {
     /*
      * 分页
      * 1.分页工具条
      *   >>分页类Page(总条数count,每页记录数);
      *   >>总条数count  where(array('status',array('gt',-1)))->$model->count();
      *   >>每页记录数  自定义也可以配置文件设置
      * 2.分页数据查询 排序
      *   >>limit(firstRow,listRow)
      */
     //分页工具条
     //$totalRows=where()->count();
     $wheres['status'] = array('gt', -1);
     $totalRows = $this->where($wheres)->count();
     $pageSize = 2;
     $page = new Page($totalRows, $pageSize);
     //更换主题
     if ($page->totalRows > $page->listRows) {
         $page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
     }
     //当起始行数大于总行数
     /**
      * $page->firstRow 起始行数
      * $page->totalRows 总行数
      * $page->listRows 每页记录数
      */
     if ($page->firstRow >= $totalRows && $page->firstRow > 0) {
         $page->firstRow = $totalRows - $pageSize;
     }
     $pageHtml = $page->show();
     //分页数据查询
     $row = $this->where($wheres)->order('sort desc')->limit($page->firstRow, $page->listRows)->select();
     return array('rows' => $row, 'pageHtml' => $pageHtml);
 }
Esempio n. 2
0
 /**
  * 加载机构流水数据。
  * @param  string $agencyId  机构ID
  * @param  string $typeId    交易类型ID
  * @param  string $flowId    资金流向ID
  * @param  string $channelId 资金渠道ID
  * @param  string $statusId  状态ID
  * @return void
  */
 public function loadRecharges($agencyId, $typeId, $flowId, $channelId, $statusId)
 {
     if (APP_DEBUG) {
         trace("加载机构流水数据[agency=>{$agencyId}][type=>{$typeId}][flow=>{$flowId}][channel=>{$channelId}][status=>{$statusId}]...");
     }
     $_where = array();
     //机构ID
     if (isset($agencyId) && !empty($agencyId)) {
         $_where['agency_id'] = $agencyId;
     }
     //交易类型ID
     if (isset($typeId) && !empty($typeId)) {
         $_where['type_id'] = $typeId;
     }
     //资金流向ID
     if (isset($flowId) && !empty($flowId)) {
         $_where['flow_id'] = $flowId;
     }
     //资金渠道ID
     if (isset($channelId) && !empty($channelId)) {
         $_where['channel_id'] = $channelId;
     }
     //状态ID
     if (isset($statusId) && !empty($statusId)) {
         $_where['status_id'] = $statusId;
     }
     //查询统计
     $_totalRows = $this->table('hk_agency_fund_water_view')->where($_where)->count();
     //查询数据
     $_page = new Page($_totalRows);
     $_data = $this->table('hk_agency_fund_water_view')->where($_where)->limit($_page->firstRow . ',' . $_page->listRows)->order('last_time desc')->select();
     //初始化数据模型
     return array('data' => $_data, 'page' => $_page->show());
 }
Esempio n. 3
0
 public function getPageResult($wheres = array())
 {
     //过滤掉不显示出来的数据
     $wheres['obj.status'] = array('gt', -1);
     //准备分页工具条数据
     $pageHtml = '';
     $pageSize = 3;
     $this->alias('obj');
     $totalRows = $this->where($wheres)->count();
     //显示的总条数
     $page = new Page($totalRows, $pageSize);
     $pageHtml = $page->show();
     //生成分页的html
     //当输入的页码过大无数据时,停留在最后一页
     if ($page->firstRow >= $totalRows) {
         $page->firstRow = $totalRows - $page->listRows;
     }
     if ($totalRows < 3) {
         $page->firstRow = 0;
     }
     //为当前模型对应的表指定一个别名
     $this->alias('obj');
     //使用表连接查询
     $this->_setModel();
     //准备分页列表数据
     $rows = $this->where($wheres)->limit($page->firstRow, $page->listRows)->select();
     //进一步处理数据
     $this->_handleRows($rows);
     //返回数据
     return array('rows' => $rows, 'pageHtml' => $pageHtml);
 }
Esempio n. 4
0
 public function getListWithPage($wheres = array())
 {
     //定义pageRasult为数组,rows为每页数据显示,pageTool是分页工具条
     //定义每页显示的数据的限制  status>-1
     $this->alias('obj');
     //设置表的别名,方便连表查询
     $wheres['obj.status'] = array('gt', -1);
     //分页工具条
     $totalRows = $this->where($wheres)->count();
     $listRows = 5;
     //生成page对象,并设置分页工具条的显示状态
     $pageModel = new Page($totalRows, $listRows);
     //设置分页工具条的外观
     $pageModel->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
     $pageTool = $pageModel->show();
     //如果总行数小于或等于每页起始行数,则将起始行数设置为总行数减去每页显示的行数
     if ($totalRows <= $pageModel->firstRow) {
         $pageModel->firstRow = $totalRows - $listRows;
         if ($pageModel->firstRow <= 0) {
             $pageModel->firstRow = 0;
         }
     }
     $this->alias('obj');
     //设置表的别名,方便连表查询
     //设置连表查询的钩子方法
     $this->_setModel();
     //每页显示条数
     $rows = $this->where($wheres)->limit($pageModel->firstRow, $pageModel->listRows)->select();
     //设置钩子方法来修改rows中的数据
     $this->_setRows($rows);
     //将结果返回
     return array('rows' => $rows, 'pageTool' => $pageTool);
 }
Esempio n. 5
0
 public function search()
 {
     $keyword = I("post.keyword");
     if ($keyword) {
         $_SESSION['keyword'] = $keyword;
     } else {
         if ($_SESSION['keyword']) {
             $keyword = $_SESSION['keyword'];
         }
     }
     if ($keyword) {
         $total = M('Ask')->where(array("sfz" => $keyword))->count();
         $Page = new \Think\Page($total, 10);
         $this->assign('page', $Page->show());
         $result = M("Ask")->where(array("sfz" => $keyword))->limit($Page->firstRow . ',' . $Page->listRows)->order("id DESC")->select();
         foreach ($result as $key => $value) {
             $member = M("Member")->where(array("uid" => $value["uid"]))->find();
             $result[$key]["nickname"] = $member["nickname"];
         }
         if (!empty($result)) {
             $this->assign("ask", $result);
             $this->display("my");
         } else {
             $this->error("无查询结果!", U('Index/respond_to_society'));
         }
     } else {
         $this->error("请输入您的证件号码!", U('Index/respond_to_society'));
     }
 }
Esempio n. 6
0
 public function index()
 {
     $id = intval($_GET['id']);
     $name = trim($_GET['n']);
     $map['title'] = array('LIKE', '%' . str_rp($name) . '%');
     $map['uid'] = $id;
     $map['status'] = 1;
     if (intval($_GET['cid'])) {
         $map['cate_id'] = intval($_GET['cid']);
     }
     if (trim($_GET['type']) == 'new') {
         $title['name'] = '最新开班';
         $order = 'addtime DESC,sort DESC';
     } else {
         $title['name'] = '课程列表';
         $order = 'sort DESC,read_count DESC';
     }
     $totalRows = $this->mod->where($map)->count();
     $page = new Page($totalRows, 10);
     $list = $this->mod->limit($page->firstRow . ',' . $page->listRows)->where($map)->order($order)->select();
     $this->list = $list;
     $this->assign('page_show', $page->show());
     $this->member_seo_set($id, '课程列表');
     $this->display();
 }
Esempio n. 7
0
 public function goods_list()
 {
     $perpage = 10;
     $page = intval(I("get." . (C('VAR_PAGE') ? C('VAR_PAGE') : 'p'))) ? intval(I('get.' . (C('VAR_PAGE') ? C('VAR_PAGE') : 'p'))) : 1;
     $limit = ($page - 1) * $perpage . "," . $perpage;
     $cate1 = D("GoodsCategory")->cate1_list();
     $this->assign('cate1', $cate1);
     if ($_GET) {
         $cate1_id = I('get.cate1_id', 0);
         $cate2_id = I('get.cate2_id', 0);
         $cate3_id = I('get.cate3_id', 0);
         $key_word = I('get.key_word', '');
         if ($cate1_id > 0) {
             $where['cate1_id'] = $cate1_id;
             // 分类信息
             $where2['cht_category2.cate1_id'] = $cate1_id;
             $cate2 = D("GoodsCategory")->cate2_list($where2);
         } else {
             $where2['cht_category2.cate1_id'] = $cate1[0]['id'];
             $cate2 = D("GoodsCategory")->cate2_list($where2);
         }
         if ($cate2_id > 0) {
             $where['cate2_id'] = $cate2_id;
             $where3['cht_category3.cate2_id'] = $cate2_id;
             $cate3 = D("GoodsCategory")->cate3_list($where3);
         } else {
             $where3['cht_category3.cate2_id'] = $cate2[0]['id'];
             $cate3 = D("GoodsCategory")->cate3_list($where3);
         }
         if ($cate3_id > 0) {
             $where['cate3_id'] = $cate3_id;
         }
         if ($key_word != '') {
             $where['goods_name'] = array('like', "%" . $key_word . "%");
         }
         $where['store_id'] = UID;
         $where['is_show'] = 1;
         $goods = $this->_Model->goods_lists($where, $limit);
         $total = $this->_Model->goods_count($where);
     } else {
         // 分类信息
         $where2['cht_category2.cate1_id'] = $cate1[0]['id'];
         $cate2 = D("GoodsCategory")->cate2_list($where2);
         $where3['cht_category3.cate2_id'] = $cate2[0]['id'];
         $cate3 = D("GoodsCategory")->cate3_list($where3);
         // 获取全部商品
         $where = array('store_id' => UID, 'is_show' => 1);
         $goods = $this->_Model->goods_lists($where, $limit);
         $total = $this->_Model->goods_count($where);
     }
     $pageobj = new Page($total, $perpage);
     $pageobj->setConfig('prev', '上一页');
     $pageobj->setConfig('next', '下一页');
     $pageshow = $pageobj->show();
     $this->assign('cate2', $cate2);
     $this->assign('cate3', $cate3);
     $this->assign("pageshow", $pageshow);
     $this->assign("goods", $goods);
     $this->display();
 }
 public function index()
 {
     $ac_id = I('cate', 0, 'int');
     $pid = M('ArticleClass')->where(array('ac_id' => $ac_id))->getField('ac_parent_id');
     if ($pid) {
         $this->ac_list = M('ArticleClass')->where(array('ac_parent_id' => $pid))->order('ac_sort desc')->select();
     } else {
         $this->ac_list = M('ArticleClass')->where(array('ac_parent_id' => $ac_id))->order('ac_sort desc')->select();
     }
     $ac_list = M('ArticleClass')->order('ac_sort desc')->select();
     $ac_list = getChildsId($ac_list, $ac_id, 'ac_id', 'ac_parent_id');
     if (is_array($ac_list)) {
         $ac_list_str = $ac_id . ',';
         foreach ($ac_list as $key => $val) {
             $ac_list_str .= $val . ',';
         }
         $ac_list_str = substr($ac_list_str, 0, -1);
     }
     $where['ac_id'] = array('IN', $ac_list_str);
     $where['article_show'] = 1;
     $count = $this->model->where($where)->count();
     $page = new Page($count, 10);
     $list = $this->model->where($where)->limit($page->firstRow . ',' . $page->listRows)->order('article_sort desc,article_time desc')->select();
     $this->list = $list;
     $this->page = $page->show();
     $this->display();
 }
Esempio n. 9
0
 /**
  * 用户中心的订单列表
  */
 public function orderlist()
 {
     $session = session('user');
     $user_id = 2;
     // $session['user_id'];
     $data['2cy_order.user_id'] = $user_id;
     if (empty($user_id)) {
         $this->assign('message', '请登录后再操作');
         $this->display('Public/error');
         exit;
     }
     $paytype = I('get.paytype');
     if ($paytype != null) {
         if ($paytype >= 0) {
             $data['2cy_order.order_type'] = $paytype;
         }
     }
     $orderModel = D('Order');
     $count = $orderModel->where($data)->count();
     $pageshowcount = 5;
     $Page = new Page($count, $pageshowcount);
     $show = $Page->pageshow();
     $orderList = $orderModel->field("2cy_order.user_id,2cy_order.order_type,2cy_order.auther,2cy_order.work_title,2cy_order.pay_money,2cy_order.money,2cy_order.order_id,2cy_order.order_number,2cy_order.create_date,works_comic.main_image_url,works_comic.tags_content")->join('left join works_comic on 2cy_order.work_id = works_comic.id')->order('create_date desc')->limit($Page->firstRow . ',' . $Page->listRows)->where($data)->select();
     $paytype = C('paystatus');
     $this->assign('orderList', $orderList);
     $this->assign('paytype', $paytype);
     $this->assign('order_type', $data['2cy_order.order_type']);
     $this->assign('show', $show);
     $this->display('orderlist');
 }
Esempio n. 10
0
 /**
  * 得到分页信息
  * @return array
  */
 public function getPageResult($where = array())
 {
     $where['obj.status'] = array('gt', -1);
     //得到分页信息
     $this->alias('obj');
     //设置表别名 查询后失效
     $count = $this->where($where)->count();
     $size = 10;
     $pageTool = new Page($count, $size);
     $pageHtml = $pageTool->show();
     //得到表信息
     $first = $pageTool->firstRow;
     if ($first >= $count && $count != 0) {
         //超界则总是在最后一页,并且记录不能为0
         $first = $count - $size;
     }
     $this->alias('obj');
     //设置表别名
     $this->_setModel();
     //链表查询--钩子
     $rows = $this->where($where)->limit($first, $pageTool->listRows)->select();
     //返回结果
     $this->_handleRows($rows);
     //处理rows数据--钩子
     return array('rows' => $rows, 'pageHtml' => $pageHtml);
 }
 public function getHot($hour = 1, $num = 10, $page = 1)
 {
     $map['create_time'] = array('gt', time() - $hour * 60 * 60);
     $map['status'] = 1;
     $weiboModel = D('Weibo');
     $all_topic = $this->where(array('status' => 1), array(array('read_count' => array('neq', 0))))->select();
     foreach ($all_topic as $key => &$v) {
         $map['content'] = array('like', "%#{$v['name']}#%");
         $v['weibos'] = $weiboModel->where($map)->count();
         if ($v['weibos'] == 0) {
             unset($all_topic[$key]);
         }
         $v['user'] = query_user(array('space_link'), $v['uadmin']);
     }
     unset($v);
     $all_topic = $this->arraySortByKey($all_topic, 'weibos', false);
     $i = 0;
     foreach ($all_topic as &$v) {
         $v['top_num'] = ++$i;
     }
     unset($v);
     $pager = new Page(count($all_topic), $num);
     // dump($all_topic);exit;
     $list['data'] = array_slice($all_topic, ($page - 1) * $num, $num);
     $list['html'] = $pager->show();
     return $list;
 }
 public function index()
 {
     $perpage = 8;
     $page = intval(I("get." . (C('VAR_PAGE') ? C('VAR_PAGE') : 'p'))) ? intval(I('get.' . (C('VAR_PAGE') ? C('VAR_PAGE') : 'p'))) : 1;
     $limit = ($page - 1) * $perpage . "," . $perpage;
     $where = array('user_id' => UID);
     if ($_GET) {
         $key_word = I('get.key_word', '');
         if ($key_word != '') {
             $where['title'] = array('like', "%" . $key_word . "%");
         }
         $requirements = $this->_Model->requirement_lists($where, $limit);
         $total = $this->_Model->requirement_count($where);
     } else {
         // 获取当前买家需求
         $requirements = $this->_Model->requirement_lists($where, $limit);
         $total = $this->_Model->requirement_count($where);
     }
     $pageobj = new Page($total, $perpage);
     $pageobj->setConfig('prev', '上一页');
     $pageobj->setConfig('next', '下一页');
     $pageshow = $pageobj->show();
     $this->assign("pageshow", $pageshow);
     $this->assign("requirements", $requirements);
     $this->display();
 }
 public function index()
 {
     $where = "int_id = c.id";
     $everypage = "10";
     //$res = $out->field("id,outtime,outprice,outamount")->relation(true)->order("outtime desc")->select();
     $tbName = D("RevenueView");
     // 实例化Data数据对象
     $count = $tbName->where($where)->count();
     // 查询满足要求的总记录数
     $Page = new Page($count, $everypage);
     // 实例化分页类 传入总记录数和每页显示的记录数(25)
     $show = $Page->show();
     // 分页显示输出// 进行分页数据查询 注意limit方法的参数要使用Page类的属性
     $list = $tbName->where($where)->order("outtime desc")->limit($Page->firstRow . ',' . $Page->listRows)->select();
     //print_r($list);
     //var_dump($list);
     //  echo "SQL:" . $tbName->getLastSql();
     $this->assign('list', $list);
     // 赋值数据集
     $this->assign('page', $show);
     // 赋值分页输出
     $outsum = $tbName->where($where)->sum("outsum");
     $this->assign("outsum", $outsum);
     $insum = $tbName->sum("insum");
     $this->assign("insum", $insum);
     $total = $outsum - $insum;
     $this->assign("total", $total);
     $this->display();
 }
Esempio n. 14
0
 /**
  * 得到分页列表中的数据
  * $pageResult = >array(
  * 'rows'=>二维数组.   分页列表数据
  * 'pageHtml'=>分页工具条的html.
  * )
  */
 public function getPageResult($wheres = array())
 {
     //有默认的条件, 在调用该方法是不需要传入.
     //因为总条数和分页列表都需要查询出状态>-1的数据
     $wheres['obj.status'] = array('gt', -1);
     //>>1.准备分页工具条html
     $pageHtml = '';
     $pageSize = 5;
     //每页多少条
     $this->alias('obj');
     $totalRows = $this->where($wheres)->count();
     //总条数
     $page = new Page($totalRows, $pageSize);
     $pageHtml = $page->show();
     //生成分页的html
     //>>2.准备分页列表数据
     //$page->firstRow 起始条数    (页码-1)*每页数
     if ($page->firstRow > $totalRows) {
         //起始条数大于总条数, 显示最后一页数据.
         $page->firstRow = $totalRows - $page->listRows;
         //起始条数= 总条数-每页多少条
     }
     $this->alias('obj');
     $this->_setModel();
     $rows = $this->where($wheres)->limit($page->firstRow, $page->listRows)->select();
     $this->_handleRows($rows);
     return array('rows' => $rows, 'pageHtml' => $pageHtml);
 }
 public function getPage($wheres = array())
 {
     //设置默认值则在调用时可以不用传入参数都可以
     //查询条件, 分页的数据和总条数数据都是需要查询出状态大于1的记录
     $wheres["obj.status"] = array("gt", -1);
     //准备分页工具条
     $pageHtml = "";
     $pageSize = 5;
     //每页多少条
     $this->alias('obj');
     $count = $this->where($wheres)->count();
     //总条数
     $page = new Page($count, $pageSize);
     $pageHtml = $page->show();
     //生成分页的html
     //分页数据
     //如果起始条数大于总的条数就直接显示最后一页的数据
     if ($page->firstRow > $count) {
         //起始条数= 总条数-每页多少条
         $page->firstRow = $count - $page->listRows;
     }
     //为表取个别名
     $this->alias('obj');
     $this->_setModel();
     //调用钩子方法
     //得到分页后的每页的数据...
     $row = $this->where($wheres)->limit($page->firstRow, $page->listRows)->select();
     //返回分页数据
     return array("rows" => $row, "pageHtml" => $pageHtml);
 }
Esempio n. 16
0
 public function adv_position()
 {
     if (IS_POST) {
         if (!empty($_POST['del_id']) && is_array($_POST['del_id'])) {
             foreach ($_POST['del_id'] as $ap_id) {
                 //删除图片
                 $ap_pic = $this->model->where('ap_id=' . $ap_id)->getField('ap_pic');
                 if ($ap_pic) {
                     @unlink(BasePath . '/Uploads/' . $ap_pic);
                 }
                 $this->model->where('ap_id=' . $ap_id)->delete();
             }
             $this->success("操作成功", U('adv_position'));
             exit;
         } else {
             $this->error("请选择要操作的对象");
         }
     } else {
         $map = array();
         if ($_GET['ap_class']) {
             $map['ap_class'] = array('eq', intval($_GET['ap_class']));
         }
         if (trim($_GET['ap_name'])) {
             $map['ap_name'] = array('like', '%' . trim($_GET['ap_name']) . '%');
         }
         $totalRows = $this->model->where($map)->count();
         $page = new Page($totalRows, 10);
         $list = $this->model->where($map)->limit($page->firstRow . ',' . $page->listRows)->order('ap_id asc')->select();
         $this->assign('list', $list);
         $this->assign('search', $_GET);
         $this->assign('show_page', $page->show());
         $this->display('adv_position_list');
     }
 }
Esempio n. 17
0
 public function index()
 {
     if (IS_POST) {
         //删除处理
         if (is_array($_POST['del_id']) && !empty($_POST['del_id'])) {
             foreach ($_POST['del_id'] as $article_id) {
                 //删除图片
                 $article_pic = $this->art->where('article_id=' . $article_id)->getField('article_pic');
                 if ($article_pic) {
                     @unlink(BasePath . '/Uploads/' . $article_pic);
                 }
                 $this->art->where('article_id=' . $article_id)->delete();
             }
             $this->success("操作成功", U('article'));
             exit;
         } else {
             $this->error("请选择要操作的对象");
         }
     } elseif (IS_GET) {
         $where = array();
         $count = $this->model->where($where)->count();
         $page = new Page($count, 10);
         $list = $this->model->where($where)->limit($page->firstRow . ',' . $page->listRows)->order('store_sort desc')->select();
         $this->assign('list', $list);
         $this->assign('show_page', $page->show());
         $this->display();
     }
 }
Esempio n. 18
0
 public function navigation()
 {
     if (IS_POST) {
         //删除处理
         if (is_array($_POST['del_id']) && !empty($_POST['del_id'])) {
             foreach ($_POST['del_id'] as $nav_id) {
                 $this->model->where('nav_id=' . $nav_id)->delete();
             }
             $this->success("操作成功", U('navigation'));
             exit;
         } else {
             $this->error("请选择要操作的对象");
         }
     }
     $map = array();
     if (trim($_GET['nav_title'])) {
         $map['nav_title'] = array('like', '%' . trim($_GET['nav_title']) . '%');
     }
     if (intval($_GET['nav_location'])) {
         $map['nav_location'] = array('eq', intval($_GET['nav_location']));
     }
     $totalRows = $this->model->where($map)->count();
     $page = new Page($totalRows, 10);
     $list = $this->model->where($map)->limit($page->firstRow . ',' . $page->listRows)->order('nav_sort desc')->select();
     $this->assign('list', $list);
     $this->assign('search', $_GET);
     $this->assign('show_page', $page->show());
     $this->display('navigation_index');
 }
Esempio n. 19
0
 public function getPageResult($wheres = array())
 {
     //默认条件,在调用该方法时不需要传入
     $wheres['status'] = array('gt', -1);
     //查询条件
     $pageHtml = "";
     //准备分页工具条
     $pageSize = 3;
     //每页显示条数
     $totalRows = $this->where($wheres)->count();
     //按条件查询出总条数
     $page = new Page($totalRows, $pageSize);
     //实例化分页类 传入总记录数和每页显示的记录数
     $page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
     //%HEADER% 总共多少条记录
     $pageHtml = $page->show();
     //分页显示输出
     if ($page->firstRow !== 0 && $page->firstRow > $totalRows) {
         //如果起始条数大于总条数,显示最后一页数据  起始条数(页码-1)*每页数
         $page->firstRow = $totalRows - $page->listRows;
         //起始条数 =总条数-每页显示条数  加入数据库里面有12条 4 那么8  下面就会根据地九条查询
     }
     $row = $this->where($wheres)->limit($page->firstRow . ',' . $page->listRows)->select();
     //准备分页列表数据
     return array('rows' => $row, 'pageHtml' => $pageHtml);
 }
Esempio n. 20
0
/**
 * @todo 分页
 * */
function page($count = 0, $rows = 0)
{
    $Page = new Page($count, $rows);
    //$Page->setConfig ( 'theme', '%first% %upPage%  %linkPage%  %downPage% %end%' );
    $show = $Page->show();
    return $show;
}
Esempio n. 21
0
 public function index()
 {
     if (IS_POST) {
         if (!empty($_POST['del_id'])) {
             $del_ids = '';
             foreach ($_POST['del_id'] as $exam_id) {
                 $del_ids .= $exam_id . ',';
             }
             $del_ids = substr($del_ids, 0, -1);
             $res = $this->model->where(array('exam_id' => array('IN', $del_ids)))->delete();
             if ($res) {
                 $this->success('删除成功');
             } else {
                 $this->error('删除失败');
             }
         }
     } elseif (IS_GET) {
         $where = array();
         if (trim($_GET['exam_question'])) {
             $where['exam_question'] = array('LIKE', '%' . str_rp(trim($_GET['exam_question'])) . '%');
         }
         $count = $this->model->where($where)->count();
         $page = new Page($count, 10);
         $list = $this->model->where($where)->limit($page->firstRow . ',' . $page->listRows)->limit('exam_sort desc')->select();
         $this->list = $list;
         $this->page = $page->show();
         $this->search = $_GET;
         $this->display();
     }
 }
Esempio n. 22
0
 public function index1()
 {
     $stu = D('stu');
     $stu_id = $stu->getstuid();
     $mix = D('Mix');
     //实例化综合素质表
     $where['stu_id'] = $stu_id;
     $count = $mix->where($where)->count();
     $page = new Think\Page($count, 10);
     $show = $page->show();
     $apply_info = $mix->where($where)->limit($page->firstRow . ',' . $page->listRows)->select();
     $stu = D('Stu');
     //实例化学生表
     $stuinfo = $stu->where('stu_id=' . $stu_id)->select();
     //提取用户信息
     //$count                   = count($apply_info);
     foreach ($apply_info as $k => $v) {
         $status_name = $mix->get_status($apply_info[$k]['status']);
         $list_info = $mix->get_info_type($apply_info[$k]['info_type']);
         $moban_info[$k]['mix_id'] = $apply_info[$k]['mix_id'];
         $moban_info[$k]['name'] = $apply_info[$k]['name'];
         $moban_info[$k]['stu_name'] = $stuinfo[0]['name'];
         $moban_info[$k]['student_id'] = $stuinfo[0]['student_id'];
         $moban_info[$k]['info_type'] = $list_info[0]['info_type_name'];
         $moban_info[$k]['item'] = $apply_info[$k]['item'];
         $moban_info[$k]['grade'] = $stuinfo[0]['grade'];
         $moban_info[$k]['status'] = $status_name[0]['status_name'];
     }
     $this->assign('show', $show);
     $this->assign('count', $count);
     $this->assign('moban_info', $moban_info);
     $this->assign('username', $username);
     $this->display();
 }
Esempio n. 23
0
 public function getPageResult($where = array())
 {
     //1.获取分页工具条数据
     $where['status'] = array('gt', -1);
     $pageSize = 2;
     //每页显示条数
     $totalRows = $this->where($where)->count();
     // 总条数
     $page = new Page($totalRows, $pageSize);
     //创建分页对象
     if ($page->totalRows > $page->listRows) {
         $page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
     }
     $pageHtml = $page->show();
     //生成分页的html
     //2.准备分页列表显示数据
     if ($page->firstRow > $totalRows) {
         //删除时当每页的起始条数大于等于总条数时,说明该页没数据了,该项前回退一页显示
         //          或  $page->firstRow==$totalRows&&$totalRows!==0&&$totalRows>$page->listRows
         $page->firstRow = $totalRows - $page->listRows;
         //起始条数=总条数-每页显示条数
     }
     $rows = $this->where($where)->limit($page->firstRow, $page->listRows)->select();
     return array('rows' => $rows, 'pageHtml' => $pageHtml);
 }
Esempio n. 24
0
 public function getList($wheres = array())
 {
     //查询条件为数据状态大于 -1  的数据
     if (!empty($wheres)) {
         $wheres['status'] = array('gt', -1);
     } else {
         $wheres['status'] = array('gt', -1);
     }
     //获取分页的工具条
     $totalRows = $this->where($wheres)->count();
     //准备数数据状态大于-1的总条数
     $listRows = 2;
     //确定每一页显示的数据条数
     //实例化分页工具条的对像
     $page = new Page($totalRows, $listRows);
     //>>判断是否要修改主题
     if ($totalRows > $listRows) {
         $page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
     }
     //存储分页的条件
     $pageHtml = $page->show();
     //>>每一页的数据删除完之后显示这页数据的上一页
     //查询出每一页需要显示的数据
     $this->limit($page->firstRow, $page->listRows)->where($wheres);
     $rows = parent::select();
     return array('rows' => $rows, 'pageHtml' => $pageHtml);
 }
Esempio n. 25
0
 public function index()
 {
     if (IS_POST) {
         if (!empty($_POST['del_id'])) {
             if (is_array($_POST['del_id'])) {
                 foreach ($_POST['del_id'] as $ac_id) {
                     $this->model->where(array('id' => $ac_id))->delete();
                 }
                 $this->success("操作成功", U('index'));
                 exit;
             }
         } else {
             $this->error("请选择要操作的对象");
         }
     } elseif (IS_GET) {
         $where = array();
         $order = '';
         $count = $this->model->where($where)->count();
         $page = new Page($count, 10);
         $list = $this->model->where($where)->order($order)->limit($page->firstRow . ',' . $page->listRows)->select();
         $this->assign('list', $list);
         $this->assign('page', $page->show());
         $this->display();
     }
 }
Esempio n. 26
0
 /**
  * @param null $map
  * @param array $page
  * @param bool $order
  * @param bool $params
  * @return array
  */
 public function queryWithPosition($map = null, $page = array('curpage' => 0, 'size' => 10), $order = false, $params = false)
 {
     $field = 'dt.name as position_name,banner.sort,banner.url,banner.noticetime,banner.endtime,banner.starttime,banner.title,banner.createtime,banner.storeid,banner.id,banner.img,banner.position,banner.notes,banner.uid';
     $query = $this->model->alias(" as banner ")->field($field)->join('LEFT JOIN common_datatree as dt ON dt.id = banner.position');
     if (!is_null($map)) {
         $query = $query->where($map);
     }
     if (!($order === false)) {
         $query = $query->order($order);
     }
     $list = $query->page($page['curpage'] . ',' . $page['size'])->select();
     if ($list === false) {
         $error = $this->model->getDbError();
         return $this->apiReturnErr($error);
     }
     $count = $this->model->where($map)->count();
     // 查询满足要求的总记录数
     $Page = new 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));
 }
Esempio n. 27
0
 public function listLog()
 {
     $mod = D('AdminLogView');
     $map = array();
     $id = trim($_GET['member_name']);
     $desc = trim($_GET['log_desc']);
     $time_from = trim($_GET['add_time_from']);
     $time_to = trim($_GET['add_time_to']);
     if ($id) {
         $map['admin_name'] = array('LIKE', '%' . $id . '%');
     }
     if ($desc) {
         $map['log_desc'] = array('LIKE', '%' . $desc . '%');
     }
     if ($time_from) {
         $time_from = strtotime($time_from);
     } else {
         $time_from = 0;
     }
     if ($time_to) {
         $time_to = strtotime($time_to) + 24 * 60 * 60;
     } else {
         $time_to = time() + 24 * 60 * 60;
     }
     $map['log_addtime'] = array('BETWEEN', array($time_from, $time_to));
     $totalRows = $mod->where($map)->count();
     $page = new Page($totalRows, 10);
     $list = $mod->where($map)->limit($page->firstRow . ',' . $page->listRows)->order('log_addtime desc')->select();
     $this->list = $list;
     $this->assign('search', $_GET);
     $this->assign('page_show', $page->show());
     $this->display();
 }
Esempio n. 28
0
 /**
  * 得到分页要准备的数据
  * @return array
  */
 public function getPageResult($wheres = array())
 {
     //排除伪删除的数据
     $wheres['obj.status'] = array('gt', -1);
     //每页显示记录数和
     $pageSize = 2;
     //伪删除之外的总的记录数
     $this->alias('obj');
     $totalRows = $this->where($wheres)->count();
     //分页工具的实例化
     $page = new Page($totalRows, $pageSize);
     //分页主题设置
     $page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
     //组装分页链接
     $pageHtml = $page->show();
     //当前页也数超过总页数的处理
     if ($totalRows == 0) {
         //当总页数为0的情况
         $page->firstRow = 0;
     } elseif ($page->firstRow >= $page->totalRows) {
         //当前页的起始行数大于等于总行数就显示最后一页的数据
         $page->firstRow = $totalRows - $page->listRows;
     }
     //每页的要显示的数据
     $this->alias('obj');
     $this->_setModel();
     $rows = $this->where($wheres)->limit($page->firstRow, $page->listRows)->select();
     $this->_handleRows($rows);
     return array('rows' => $rows, 'pageHtml' => $pageHtml);
 }
 /**
  * 用户管理
  */
 public function userManage()
 {
     $username = I('post.username');
     $params = array();
     if (!empty($username)) {
         $params['user_name'] = $username;
     }
     $telephone = I('post.telephone');
     if (!empty($telephone)) {
         $params['telephone'] = $telephone;
     }
     $sex = I('post.sex');
     if (!empty($sex) && $sex != -1) {
         $params['sex'] = $sex;
     }
     $province = I('post.province');
     if (!empty($province) && $province != 0) {
         $params['province'] = $province;
     }
     $city = I('post.city');
     if (!empty($city) && $city != 0) {
         $params['city'] = $city;
     }
     $area = I('post.area');
     if (!empty($area) && $area != 0) {
         $params['district'] = $area;
     }
     //dump(I('POST.'));
     $usertype = I('post.usertype');
     if (isset($usertype) && $usertype != '-1' && $usertype != '') {
         $params['user_type'] = $usertype;
     }
     //dump($usertype);
     $isenable = I('post.isenable');
     if (isset($isenable) && $isenable != -1 && $isenable != '') {
         $params['is_enable'] = $isenable;
     }
     //dump($params);
     $numPerPage = I('numPerPage');
     $pageNum = I('pageNum');
     //当前页号
     if (empty($numPerPage)) {
         $numPerPage = NUMPERPAGE;
     }
     if (empty($pageNum)) {
         $pageNum = PAGENUM;
     }
     $user = M('user');
     $count = $user->where($params)->count();
     $list = $user->where($params)->limit($numPerPage)->page($pageNum)->select();
     $this->assign("list", $list);
     $page = new Page($count, $numPerPage);
     $page->show();
     //dump($page);
     $this->assign('pageNum', $pageNum);
     $this->assign('numPerPage', $numPerPage);
     $this->assign("page", $page);
     $this->display();
 }
Esempio n. 30
0
 public function logList($where = "1=1")
 {
     $logs = $this->where($where)->page((isset($_GET['p']) ? $_GET['p'] : 0) . ',25')->order('id desc')->select();
     $count = $this->where($where)->count();
     $Page = new Page($count, 25);
     $show = $Page->show();
     return array("data" => $logs, "page" => $show);
 }