From 84a941a1fc1f36f85444227137d0a9fb2e8d2c63 Mon Sep 17 00:00:00 2001 From: weiz Date: Tue, 28 Nov 2023 09:23:40 +0800 Subject: [PATCH] fixed --- app/api/controller/LandController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/api/controller/LandController.php b/app/api/controller/LandController.php index 61854a62..ee1f7195 100644 --- a/app/api/controller/LandController.php +++ b/app/api/controller/LandController.php @@ -129,13 +129,14 @@ public function product(): Json { $data = Product::field('id as product_id,code,name')->where('status',1)->select()->toArray(); + $result = []; foreach ($data as $k=>$v) { $productDevice = ProductDevice::where('product_id',$v['product_id'])->select()->toArray(); - if(empty($productDevice)){ - unset($data[$k]); + if(!empty($productDevice)){ + $result[] = $v; } } - return $this->success('请求成功',$data); + return $this->success('请求成功',$result); } //绑定产品