post=$this->request->post(); } public function list(){ $page = isset($this->post['page']) && $this->post['page'] !=="" ? intval($this->post['page']):"1"; $size = isset($this->post['size']) && $this->post['size'] !=="" ? intval($this->post['size']):"10"; $where =['is_del'=>0]; $bkcode = isset($this->post['bk_code']) && $this->post['bk_code']!="" ? trim($this->post['bk_code']):""; if($bkcode!=""){ $where['bk_code'] = $bkcode; } $good_code = isset($this->post['good_code']) && $this->post['good_code']!="" ? trim($this->post['good_code']):""; if($good_code!=""){ $where['good_code'] = $good_code; } $good_type_code = isset($this->post['good_type_code']) && $this->post['good_type_code']!="" ? trim($this->post['good_type_code']):""; if($good_type_code!=""){ $where['good_type_code'] = $good_type_code; } $wsm_code = isset($this->post['wsm_code']) && $this->post['wsm_code']!="" ? trim($this->post['wsm_code']):""; if($wsm_code!=""){ $where['wsm_code'] = $wsm_code; } $good_name = isset($this->post['good_name']) && $this->post['good_name']!="" ? trim($this->post['good_name']):""; if($good_name!=""){ $where['good_name'] = Db::raw(" like %{$good_name}%"); } $count=Db::name("purchease")->where($where)->count(); $total = ceil($count/$size); $page = $page >= $total ? $total : $page; $list = Db::name("purchease")->where($where)->page($page,$size)->select(); return app_show(0,"获取成功",["list"=>$list,"count"=>$count]); } }