$params['soil_temp_max'], 'soil_temp_min' => $params['soil_temp_min'], 'soil_mois_max' => $params['soil_mois_max'], 'soil_mois_min' => $params['soil_mois_min'], 'soil_ph_max' => $params['soil_ph_max'], 'soil_ph_min' => $params['soil_ph_min'], 'soil_n_content_max' => $params['soil_n_content_max'], 'soil_n_content_min' => $params['soil_n_content_min'], 'soil_p_content_max' => $params['soil_p_content_max'], 'soil_p_content_min' => $params['soil_p_content_min'], 'soil_k_content_max' => $params['soil_k_content_max'], 'soil_k_content_min' => $params['soil_k_content_min'], 'air_temp_max' => $params['air_temp_max'], 'air_temp_min' => $params['air_temp_min'], 'air_mois_max' => $params['air_mois_max'], 'air_mois_min' => $params['air_mois_min'], 'air_co2_content_max' => $params['air_co2_content_max'], 'air_co2_content_min' => $params['air_co2_content_min'], 'wind_speed_max' => $params['wind_speed_max'], 'wind_speed_min' => $params['wind_speed_min'], ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 编辑 * @param array $params * @return bool * @author likeadmin * @date 2023/11/24 16:17 */ public static function edit(array $params): bool { Db::startTrans(); try { MonitorThreshold::where('id', $params['id'])->update([ 'soil_temp_max' => $params['soil_temp_max'], 'soil_temp_min' => $params['soil_temp_min'], 'soil_mois_max' => $params['soil_mois_max'], 'soil_mois_min' => $params['soil_mois_min'], 'soil_ph_max' => $params['soil_ph_max'], 'soil_ph_min' => $params['soil_ph_min'], 'soil_n_content_max' => $params['soil_n_content_max'], 'soil_n_content_min' => $params['soil_n_content_min'], 'soil_p_content_max' => $params['soil_p_content_max'], 'soil_p_content_min' => $params['soil_p_content_min'], 'soil_k_content_max' => $params['soil_k_content_max'], 'soil_k_content_min' => $params['soil_k_content_min'], 'air_temp_max' => $params['air_temp_max'], 'air_temp_min' => $params['air_temp_min'], 'air_mois_max' => $params['air_mois_max'], 'air_mois_min' => $params['air_mois_min'], 'air_co2_content_max' => $params['air_co2_content_max'], 'air_co2_content_min' => $params['air_co2_content_min'], 'wind_speed_max' => $params['wind_speed_max'], 'wind_speed_min' => $params['wind_speed_min'], ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 删除 * @param array $params * @return bool * @author likeadmin * @date 2023/11/24 16:17 */ public static function delete(array $params): bool { return MonitorThreshold::destroy($params['id']); } /** * @notes 获取详情 * @param $params * @return array * @author likeadmin * @date 2023/11/24 16:17 */ public static function detail($params): array { return MonitorThreshold::findOrEmpty($params['id'])->toArray(); } }