From d1d70966d37eb07f15fb88d4e6bf36a20fe01e04 Mon Sep 17 00:00:00 2001 From: weiz <736250432@qq.com> Date: Wed, 6 Mar 2024 22:44:03 +0800 Subject: [PATCH] update --- app/api/controller/dataview/FarmController.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/api/controller/dataview/FarmController.php b/app/api/controller/dataview/FarmController.php index 198b3ec..db170fb 100644 --- a/app/api/controller/dataview/FarmController.php +++ b/app/api/controller/dataview/FarmController.php @@ -151,13 +151,13 @@ class FarmController extends BaseApiController })->select()->toArray(); // 请求mqtt接口 - $list = RemoteRequestLogic::getAlarmData($deviceList); - foreach($list as $k=>$v){ + $data = RemoteRequestLogic::getAlarmData($deviceList); + foreach($data as $k=>$v){ $time[$k] = strtotime($v['alarm_time']); } - array_multisort($time, SORT_DESC, $list); - $resultArray = array_slice($list, 0, 7); - return $this->success('成功', compact('resultArray')); + array_multisort($time, SORT_DESC, $data); + $list = array_slice($data, 0, 7); + return $this->success('成功', compact('list')); } // 监测设备数量统计