diff --git a/app/adminapi/logic/device/DeviceLogic.php b/app/adminapi/logic/device/DeviceLogic.php index 7ffc8055..bd3b50ac 100644 --- a/app/adminapi/logic/device/DeviceLogic.php +++ b/app/adminapi/logic/device/DeviceLogic.php @@ -125,6 +125,9 @@ class DeviceLogic extends BaseLogic */ public static function delete(array $params): bool { + Db::name('product_device')->where('device_id', $params['id'])->delete(); + Db::name('device_monitor_data')->where('device_id', $params['id'])->delete(); + Db::name('monitor_alarm')->where('device_id', $params['id'])->delete(); return Device::destroy($params['id']); } diff --git a/app/adminapi/logic/land/LandPlantLogic.php b/app/adminapi/logic/land/LandPlantLogic.php index e76299a7..9a7debcd 100644 --- a/app/adminapi/logic/land/LandPlantLogic.php +++ b/app/adminapi/logic/land/LandPlantLogic.php @@ -108,6 +108,7 @@ class LandPlantLogic extends BaseLogic */ public static function delete(array $params): bool { + Db::name('land_plant_action')->where('plant_id', $params['id'])->delete(); return LandPlant::destroy($params['id']); } diff --git a/app/adminapi/logic/land/ProductLogic.php b/app/adminapi/logic/land/ProductLogic.php index 8e7df0c7..c2de4658 100644 --- a/app/adminapi/logic/land/ProductLogic.php +++ b/app/adminapi/logic/land/ProductLogic.php @@ -106,6 +106,7 @@ class ProductLogic extends BaseLogic public static function delete(array $params): bool { Db::name('land_product')->where('product_id', $params['id'])->delete(); + Db::name('monitor_data')->where('product_id', $params['id'])->delete(); return Product::destroy($params['id']); }