From 3b6734a199f44b60bc1ed04989d36fcfd462ee59 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Fri, 15 Dec 2023 10:13:46 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E8=AD=A6=E7=B1=BB=E5=9E=8B=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E8=8B=B1=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/DataCollectController.php | 54 ++++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/app/api/controller/DataCollectController.php b/app/api/controller/DataCollectController.php index 8d60188c..2055cd3d 100644 --- a/app/api/controller/DataCollectController.php +++ b/app/api/controller/DataCollectController.php @@ -61,45 +61,45 @@ class DataCollectController extends BaseApiController $monitorThreshold = (new MonitorThreshold())->select()->toArray()[0]; // 风速告警 if ($payload['wind_speed'] > $monitorThreshold['wind_speed_max']) { - self::createAlarm($land[3], $device[1], '风速', '风速偏快' ,$payload['wind_speed']); + self::createAlarm($land[3], $device[1], 'wind_speed', '风速偏快' ,$payload['wind_speed']); } // ambient_temperature 环境温度 if ($payload['ambient_temperature'] < $monitorThreshold['air_temp_min']) { - self::createAlarm($land[3], $device[1], '环境温度', '气温偏低' ,$payload['ambient_temperature']); + self::createAlarm($land[3], $device[1], 'ambient_temperature', '气温偏低' ,$payload['ambient_temperature']); } // ambient_temperature 环境温度 if ($payload['ambient_temperature'] > $monitorThreshold['air_temp_max']) { - self::createAlarm($land[3], $device[1], '环境温度', '气温偏高' ,$payload['ambient_temperature']); + self::createAlarm($land[3], $device[1], 'ambient_temperature', '气温偏高' ,$payload['ambient_temperature']); } // ambient_humidity 环境湿度 if ($payload['ambient_humidity'] < $monitorThreshold['air_mois_min']) { - self::createAlarm($land[3], $device[1], '环境湿度', '环境湿度偏低' ,$payload['ambient_humidity']); + self::createAlarm($land[3], $device[1], 'ambient_humidity', '环境湿度偏低' ,$payload['ambient_humidity']); } // ambient_humidity 环境湿度 if ($payload['ambient_humidity'] < $monitorThreshold['air_mois_max']) { - self::createAlarm($land[3], $device[1], '环境湿度', '环境湿度偏高' ,$payload['ambient_humidity']); + self::createAlarm($land[3], $device[1], 'ambient_humidity', '环境湿度偏高' ,$payload['ambient_humidity']); } // carbon_dioxide 二氧化碳含量 if ($payload['carbon_dioxide'] > $monitorThreshold['air_co2_content_max']) { - self::createAlarm($land[3], $device[1], '二氧化碳含量', '空气二氧化碳含量偏高' ,$payload['carbon_dioxide']); + self::createAlarm($land[3], $device[1], 'carbon_dioxide', '空气二氧化碳含量偏高' ,$payload['carbon_dioxide']); } // carbon_dioxide 二氧化碳含量 if ($payload['carbon_dioxide'] < $monitorThreshold['air_co2_content_min']) { - self::createAlarm($land[3], $device[1], '二氧化碳含量', '空气二氧化碳含量偏低' ,$payload['carbon_dioxide']); + self::createAlarm($land[3], $device[1], 'carbon_dioxide', '空气二氧化碳含量偏低' ,$payload['carbon_dioxide']); } // ambient_air_pressure 大气压力 if ($payload['ambient_air_pressure'] >= 120) { - self::createAlarm($land[3], $device[1], '大气压力', '大气压力偏高' ,$payload['ambient_air_pressure']); + self::createAlarm($land[3], $device[1], 'ambient_air_pressure', '大气压力偏高' ,$payload['ambient_air_pressure']); } if ($payload['ambient_air_pressure'] < 10) { - self::createAlarm($land[3], $device[1], '大气压力', '大气压力偏低' ,$payload['ambient_air_pressure']); + self::createAlarm($land[3], $device[1], 'ambient_air_pressure', '大气压力偏低' ,$payload['ambient_air_pressure']); } // rainfall 雨量 @@ -108,11 +108,11 @@ class DataCollectController extends BaseApiController // soil_temperature 土壤温度 if ($payload['soil_temperature'] >= $monitorThreshold['soil_temp_max']) { - self::createAlarm($land[3], $device[1], '土壤温度', '土壤温度偏高' ,$payload['soil_temperature']); + self::createAlarm($land[3], $device[1], 'soil_temperature', '土壤温度偏高' ,$payload['soil_temperature']); } // soil_temperature 土壤温度 if ($payload['soil_temperature'] < $monitorThreshold['soil_temp_min']) { - self::createAlarm($land[3], $device[1], '土壤温度', '土壤温度偏低' ,$payload['soil_temperature']); + self::createAlarm($land[3], $device[1], 'soil_temperature', '土壤温度偏低' ,$payload['soil_temperature']); } // soil_conductivity 土壤电导率 @@ -125,42 +125,42 @@ class DataCollectController extends BaseApiController // soil_conductivity 土壤湿度 if ($payload['soil_moisture'] < $monitorThreshold['soil_mois_max']) { - self::createAlarm($land[3], $device[1], '土壤湿度', '土壤湿度偏高' ,$payload['soil_moisture']); + self::createAlarm($land[3], $device[1], 'soil_moisture', '土壤湿度偏高' ,$payload['soil_moisture']); } if ($payload['soil_moisture'] < $monitorThreshold['soil_mois_min']) { - self::createAlarm($land[3], $device[1], '土壤湿度', '土壤湿度偏低' ,$payload['soil_moisture']); + self::createAlarm($land[3], $device[1], 'soil_moisture', '土壤湿度偏低' ,$payload['soil_moisture']); } // soil_PH 土壤ph值 if ($payload['soil_PH'] < $monitorThreshold['soil_ph_max']) { - self::createAlarm($land[3], $device[1], '土壤PH值', '土壤PH值偏碱性' ,$payload['soil_moisture']); + self::createAlarm($land[3], $device[1], 'soil_PH', '土壤PH值偏碱性' ,$payload['soil_moisture']); } if ($payload['soil_PH'] < $monitorThreshold['soil_ph_min']) { - self::createAlarm($land[3], $device[1], '土壤PH值', '土壤PH值偏酸性' ,$payload['soil_moisture']); + self::createAlarm($land[3], $device[1], 'soil_PH', '土壤PH值偏酸性' ,$payload['soil_moisture']); } // soil_potassium_phosphate_nitrogen 土壤磷酸钾:氮 - if ($payload['soil_PH'] < $monitorThreshold['soil_n_content_max']) { - self::createAlarm($land[3], $device[1], '土壤磷酸钾-氮', '土壤磷酸钾-含氮量偏高' ,$payload['soil_moisture']); + if ($payload['soil_potassium_phosphate_nitrogen'] < $monitorThreshold['soil_n_content_max']) { + self::createAlarm($land[3], $device[1], 'soil_potassium_phosphate_nitrogen', '土壤磷酸钾-含氮量偏高' ,$payload['soil_potassium_phosphate_nitrogen']); } - if ($payload['soil_PH'] < $monitorThreshold['soil_n_content_min']) { - self::createAlarm($land[3], $device[1], '土壤磷酸钾-氮', '土壤磷酸钾-含氮量偏低' ,$payload['soil_moisture']); + if ($payload['soil_potassium_phosphate_nitrogen'] < $monitorThreshold['soil_n_content_min']) { + self::createAlarm($land[3], $device[1], 'soil_potassium_phosphate_nitrogen', '土壤磷酸钾-含氮量偏低' ,$payload['soil_potassium_phosphate_nitrogen']); } // soil_potassium_phosphate_phosphorus 土壤磷酸钾:磷 - if ($payload['soil_PH'] < $monitorThreshold['soil_p_content_max']) { - self::createAlarm($land[3], $device[1], '土壤磷酸钾-磷', '土壤磷酸钾-含磷量偏高' ,$payload['soil_moisture']); + if ($payload['soil_potassium_phosphate_phosphorus'] < $monitorThreshold['soil_p_content_max']) { + self::createAlarm($land[3], $device[1], 'soil_potassium_phosphate_phosphorus', '土壤磷酸钾-含磷量偏高' ,$payload['soil_potassium_phosphate_phosphorus']); } - if ($payload['soil_PH'] < $monitorThreshold['soil_p_content_min']) { - self::createAlarm($land[3], $device[1], '土壤磷酸钾-磷', '土壤磷酸钾-含磷量偏低' ,$payload['soil_moisture']); + if ($payload['soil_potassium_phosphate_phosphorus'] < $monitorThreshold['soil_p_content_min']) { + self::createAlarm($land[3], $device[1], 'soil_potassium_phosphate_phosphorus', '土壤磷酸钾-含磷量偏低' ,$payload['soil_potassium_phosphate_phosphorus']); } // soil_potassium_phosphate_potassium 土壤磷酸钾:钾 - if ($payload['soil_PH'] < $monitorThreshold['soil_k_content_max']) { - self::createAlarm($land[3], $device[1], '土壤磷酸钾-钾', '土壤磷酸钾-含钾量偏高' ,$payload['soil_moisture']); + if ($payload['soil_potassium_phosphate_potassium'] < $monitorThreshold['soil_k_content_max']) { + self::createAlarm($land[3], $device[1], 'soil_potassium_phosphate_potassium', '土壤磷酸钾-含钾量偏高' ,$payload['soil_potassium_phosphate_potassium']); } - if ($payload['soil_PH'] < $monitorThreshold['soil_k_content_min']) { - self::createAlarm($land[3], $device[1], '土壤磷酸钾-钾', '土壤磷酸钾-含钾量偏低' ,$payload['soil_moisture']); + if ($payload['soil_potassium_phosphate_potassium'] < $monitorThreshold['soil_k_content_min']) { + self::createAlarm($land[3], $device[1], 'soil_potassium_phosphate_potassium', '土壤磷酸钾-含钾量偏低' ,$payload['soil_potassium_phosphate_potassium']); } return $this->success('接收成功', ['user_name'=>$parmas['username'], 'topic'=>$parmas['topic']]);