thinkphp分页条件丢失

浏览:853 发布日期:2016/11/23 分类:求助交流 关键字: thinkphp 分页 丢失

大神们,我GET传过来的条件在分页第二页的时候会丢失,怎样保存住 呢?public function cw_drawRecord(){
        $userId = session('user')['member_id'];
        $userName = session('username');
        if($_GET){
            
            if($_GET['time']=="all"){
                $start_time = 0; 
                $end_time = time();
            }
            if($_GET['time']=="week"){
                $start_time = strtotime(date("Y-m-d", strtotime("-1 week"))); 
                $end_time = time();
            }
            if($_GET['time']=="month"){
                $start_time = strtotime(date("Y-m-d", strtotime("-1 month"))); 
                $end_time = time();
            }
            if($_GET['time']=="year"){
                $start_time = strtotime(date("Y-m-d", strtotime("-1 year"))); 
                $end_time = time();
            }
            if($_GET['id']=="record"){
                $start_time = strtotime(date("Y-m-d", strtotime(0)));  
                $end_time = time();
            }
            if($_GET['time']=="Period"){
                $start_time = strtotime($_GET['start']);
                $end_time = strtotime($_GET['end']);
            }

        }else{
            $end_time = time();
            $start_time = 0;    
        }
            $condition['withdraw_time'] = array(between,array($start_time,$end_time));
            $condition['member_id'] = $userId;
            $bill_withdraw = M('bill_withdraw');
            $count = $bill_withdraw->where($condition)->count();// 查询满足要求的总记录数

            $Page = new \Think\Page($count,6);// 实例化分页类 传入总记录数和每页显示的记录数
            $show = $Page->show();// 分页显示输出
            $list =$bill_withdraw->where($condition)->field('withdraw_sn,withdraw_time,withdraw_money,withdraw_bank_num,withdraw_bank_name,withdraw_status,withdraw_mark')->limit($Page->firstRow. ',' . $Page->listRows)->order('withdraw_time desc')->select();
            echo M()->_sql();
            foreach($list as $key=>$value){
                $new_list[$key]['withdraw_sn'] = $value['withdraw_sn'];
                $new_list[$key]['withdraw_time'] = $value['withdraw_time'];
                $new_list[$key]['withdraw_money'] = $value['withdraw_money'];
                $new_list[$key]['withdraw_bank_num'] = substr($value['withdraw_bank_num'],-4,4);
                $new_list[$key]['withdraw_bank_name'] = $value['withdraw_bank_name'];
                $new_list[$key]['withdraw_status'] = $value['withdraw_status'];
                $new_list[$key]['withdraw_mark'] = $value['withdraw_mark'];
            }
            $this->assign('list',$new_list);
            $this->assign('page',$show);// 赋值分页输出
            $this->assign('userName',$userName);
             layout("Layout/main");
            $this->display();
   }
最佳答案
评论( 相关
后面还有条评论,点击查看>>