From 12b0e98a1c35e4d7372600a28fb587cca37c48b9 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Mon, 15 Jan 2024 15:32:21 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E5=9F=BA=E5=9C=B0=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/FarmController.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 app/api/controller/FarmController.php diff --git a/app/api/controller/FarmController.php b/app/api/controller/FarmController.php new file mode 100644 index 0000000..cc50d58 --- /dev/null +++ b/app/api/controller/FarmController.php @@ -0,0 +1,23 @@ +request->get(['page_no','page_size','keyword']); + $pageNo = empty($params['page_no']) ? 1 : $params['page_no']; + $pageSize = empty($params['page_size']) ? 6 : $params['page_size']; + $where = [ + ['user_id','=',$this->userId] + ]; + if(!empty($params['keyword'])){ + $where[] = ['farm_name','like','%'.$params['keyword'].'%']; + } + $data = Farm::where($where)->page($pageNo,$pageSize)->order('create_time desc')->select()->toArray(); + return $this->success('请求成功',$data); + } +} \ No newline at end of file