diff --git a/app/api/controller/PlantController.php b/app/api/controller/PlantController.php index 2809e3d1..08deb26f 100644 --- a/app/api/controller/PlantController.php +++ b/app/api/controller/PlantController.php @@ -24,6 +24,20 @@ return $this->success('请求成功',$data); } + public function detail(): Json + { + $params = $this->request->get(['plant_id']); + if(empty($params['plant_id'])){ + return $this->fail('缺少必要参数'); + } + $data = Plant::where('id',$params['plant_id'])->findOrEmpty(); + if($data->isEmpty()){ + return $this->fail('种植信息错误'); + } + $data['pic'] = json_decode($data['pic'],true); + return $this->success('请求成功',$data->toArray()); + } + //添加种植 public function add(): Json {