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