Compare commits

...

2 Commits

1 changed files with 8 additions and 2 deletions

View File

@ -16,10 +16,16 @@
//土地列表 //土地列表
public function list(): Json public function list(): Json
{ {
$params = $this->request->post(['page_no','page_size']); $params = $this->request->get(['page_no','page_size','keyword']);
$pageNo = empty($params['page_no']) ? 1 : $params['page_no']; $pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
$pageSize = empty($params['page_size']) ? 6 : $params['page_size']; $pageSize = empty($params['page_size']) ? 6 : $params['page_size'];
$data = Land::where('user_id',$this->userId)->page($pageNo,$pageSize)->order('create_time desc')->select()->each(function($item){ $where = [
['user_id','=',$this->userId]
];
if(!empty($params['keyword'])){
$where[] = ['title','like','%'.$params['keyword'].'%'];
}
$data = Land::where($where)->page($pageNo,$pageSize)->order('create_time desc')->select()->each(function($item){
$item['pic'] = json_decode($item['pic']); $item['pic'] = json_decode($item['pic']);
return $item; return $item;
})->toArray(); })->toArray();