fixed-2024-03-06-02

This commit is contained in:
weiz 2024-03-06 22:38:52 +08:00
parent 9994edcd5f
commit 91f0b26f07
1 changed files with 4 additions and 5 deletions

View File

@ -153,12 +153,11 @@ class FarmController extends BaseApiController
// 请求mqtt接口
$list = RemoteRequestLogic::getAlarmData($deviceList);
foreach($list as $k=>$v){
if(time() - strtotime($v['alarm_time']) > 604800){
unset($list[$k]);
$time[$k] = strtotime($v['alarm_time']);
}
}
return $this->success('成功', compact('list'));
array_multisort($time, SORT_DESC, $list);
$resultArray = array_slice($list, 0, 7);
return $this->success('成功', compact('resultArray'));
}
// 监测设备数量统计