示例#1
0
$count = count($ports);
//端口数
$summaryData = array();
//汇总数据(MAX MIN AVG)
foreach ($ports as $pItem) {
    $result = array();
    $dayOne = array();
    $bandwidthOutOne = array();
    $bandwidthInOne = array();
    $percOutOne = array();
    $percInOne = array();
    $summaryDataOne = array();
    if ($type == 0) {
        //按天统计
        $result = RoomBussflow::getBandwithByDay($network, $mroom, $pItem['PORTS'], $start_date, $end_date, $accountType, $time_ids);
        $summaryDataResult = RoomBussflow::getSummaryDataByDay($network, $mroom, $pItem['PORTS'], $start_date, $end_date, $time_ids);
    }
    if ($type == 1) {
        //按小时统计
        $result = RoomBussflow::getBandwithByHours($network, $mroom, $pItem['PORTS'], $start_date, $end_date, $accountType, $time_ids);
        $summaryDataResult = RoomBussflow::getSummaryDataByHours($network, $mroom, $pItem['PORTS'], $start_date, $end_date, $time_ids);
    }
    if (!empty($result)) {
        foreach ($result as $rItem) {
            $dayOne[] = $rItem['UPDATE_TIME'];
            $bandwidthOutOne[] = $rItem['BANDWIDTH_OUT'];
            $bandwidthInOne[] = $rItem['BANDWIDTH_IN'];
            $percOutOne[] = floatval($rItem['PERC_OUT']);
            $percInOne[] = floatval($rItem['PERC_IN']);
        }
        $day[] = $dayOne;