From b4ebd357c24dea732696d8e151a0cbbe7e11f236 Mon Sep 17 00:00:00 2001 From: weiz Date: Mon, 27 Nov 2023 15:06:47 +0800 Subject: [PATCH] fixed --- app/api/controller/PlantController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/api/controller/PlantController.php b/app/api/controller/PlantController.php index 95bbfaf7..2809e3d1 100644 --- a/app/api/controller/PlantController.php +++ b/app/api/controller/PlantController.php @@ -40,10 +40,13 @@ return $this->fail('图片参数格式错误'); } //获取土地信息 - $land = Land::field('residual_area')->where('id',$params['land_id'])->findOrEmpty(); + $land = Land::field('user_id,residual_area')->where('id',$params['land_id'])->findOrEmpty(); if($land->isEmpty()){ return $this->fail('土地信息错误'); } + if($land['user_id'] != $this->userId){ + return $this->fail('土地信息与用户信息不匹配'); + } if($params['area'] > $land['residual_area']){ return $this->fail('种植面积超过当前土地可种植面积'); }