2, 'msg_type' => 3, 'is_notice' => 1 ]; $list = AdminNotice::query()->where($where)->select()->get(); foreach ($list as $item) { $updated_at = $item['updated_at']; $updated_times = strtotime($updated_at); $diff_times = $now_times - $updated_times; $camera_status = ParkingCamera::query()->where( 'id', $item['camera_id'] )->value('status'); $updated = [ 'updated_at' => $now_time ]; if ($camera_status) { $updated['is_notice'] = 0; AdminNotice::query()->where('id', $item['id'])->update( $updated ); } elseif ($diff_times >= 300) { AdminNoticeService::eventInfo( $item['id'], 2, 3, $item['alarm_time'] ); AdminNotice::query()->where('id', $item['id'])->update( $updated ); } } DB::commit(); } catch (Exception $e) { DB::rollBack(); } } }