tp3.2搜索加分页

故事扮演 提交于 2019-12-09 19:02:14

public function dadlist($request)
    {    
        $npost = array_merge($_GET,$_POST);
        if(!empty($npost['status'])){
            $dds['status'] = $npost['status'];
        }
        if(!empty($npost['ordernum'])){
            $dds['ordernum'] = ['like',"%".$npost['ordernum']."%"];
        }
        if(!empty($npost['preordernum'])){
            $dds['preordernum'] = ['like',"%".$npost['preordernum']."%"];
        }
        if(!empty($npost['userid'])){
            $dds['userid'] = $npost['userid'];
        }
        $count = M('Dd')->where($dds)->count();
        $Page  = $page = new \Think\Page($count, 15,$npost);
        $show  = $Page->show();
        $list  = M('Dd')->where($dds)->order('id desc')->limit($Page->firstRow . ',' . $Page->listRows)->select();
        //var_dump($list);die;
        $params = array(
            'ddlist' => $list,
            'count' => $count,
            'Page' => $show,
            'pageName' => '列表'
        );
                
        return [1,$params];
    }

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!