Exemplo n.º 1
0
 /**
  * wifi每7日连接详情数据ajax
  */
 public function wifiweekinfoAction()
 {
     $page = reqnum('page', 1);
     $pagesize = reqnum('rp', 100);
     //接收排序
     $sortname = reqstr('sortname', 'date');
     $sortorder = reqstr('sortorder', 'asc');
     $isgrahp = reqnum('isgrahp');
     $nt = new Psys_StationModel();
     $data = $nt->WifiWeekInfo($sortname, $sortorder, $page, $pagesize);
     if ($data['allnum'] <= 0) {
         return 0;
     }
     //拼接返回的表格数据格式
     $res['total'] = $data['allnum'];
     $res['page'] = $page;
     $res['rows'] = $data['allrow'];
     $graph = array();
     foreach ($res['rows'] as &$v) {
         $graph[] = $v['cell'] = array_values($v);
         array_splice($v, 0, 5);
     }
     //拼接统计图数据格式
     $nts = new Psys_ResourceModel();
     $ydata = array();
     if ($isgrahp) {
         foreach ($graph as $k => $v) {
             $cat = explode('-', $v[0]);
             $x_date = $result['x_cat'][] = substr($cat[0], 5) . '-' . substr($cat[1], 5);
             $sdate = str_replace('/', '_', $cat[0]);
             $edate = str_replace('/', '_', $cat[1]);
             $dates = array($sdate, $edate);
             $eventrecordinfo = $nts->EventRecordInfo($dates, 0, 1, true);
             //返回特殊点的提示信息
             $title = '';
             $descript = '';
             if (!empty($eventrecordinfo)) {
                 $flag = 1;
                 foreach ($eventrecordinfo as $info) {
                     $infodate = str_replace('_', '-', $info['date']);
                     $infodates = date('m/d', strtotime($infodate));
                     $title .= '<br /><b>' . $info['title'] . '</b><br />' . $info['descript'] . '<br />';
                     $descript = '<br />';
                 }
             } else {
                 $flag = 0;
             }
             $infos['date' . $x_date]['title'] = $title;
             $infos['date' . $x_date]['descript'] = $descript;
             //拼接数据
             array_shift($v);
             if (!$flag) {
                 // $datas[0]['data'][] = (int)$v['num'];
                 $totalconn[] = (int) $v[0];
                 /*$avgdaily[] = (int)$v[1];
                 		$avghour[] = (int)$v[2];
                 		$avgtop[] = (int)$v[3];*/
             } else {
                 /*$datas[0]['data'][] = array('y'=>(int)$v['num'],
                 		'marker'=>array('fillColor'=>'#FF0000','lineColor'=>'#FF0000',//设置当前点的颜色
                 		'states'=>array('hover'=>array('fillColor'=>'#FF0000','lineColor'=>'#FF0000'))));//设置当前点鼠标经过的颜色*/
                 $totalconn[] = array('y' => (int) $v[0], 'marker' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000', 'states' => array('hover' => array('fillColor' => '#FF0000', 'lineColor' => '#FF0000'))));
             }
             /*$totalconn[] = (int)$v[0];
             		$avgdaily[] = (int)$v[1];
             		$avghour[] = (int)$v[2];
             		$avgtop[] = (int)$v[3];*/
             $result['y_data'] = array(array('name' => '总连接数', 'data' => $totalconn, 'infos' => $infos));
         }
         return $result;
     }
     return $res;
 }
 /**
  * wifi每7日连接详情数据ajax
  */
 public function wifiweekinfoAction()
 {
     $page = reqnum('page', 1);
     $pagesize = reqnum('rp', 100);
     //接收排序
     $sortname = reqstr('sortname', 'date');
     $sortorder = reqstr('sortorder', 'asc');
     $isgrahp = reqnum('isgrahp');
     $nt = new Psys_StationModel();
     $data = $nt->WifiWeekInfo($sortname, $sortorder, $page, $pagesize);
     if ($data['allnum'] <= 0) {
         return 0;
     }
     //拼接返回的表格数据格式
     $res['total'] = $data['allnum'];
     $res['page'] = $page;
     $res['rows'] = $data['allrow'];
     $graph = array();
     foreach ($res['rows'] as &$v) {
         $graph[] = $v['cell'] = array_values($v);
         array_splice($v, 0, 5);
     }
     //拼接统计图数据格式
     $ydata = array();
     if ($isgrahp) {
         foreach ($graph as $k => $v) {
             $cat = explode('-', $v[0]);
             $result['x_cat'][] = substr($cat[0], 3) . '-' . substr($cat[1], 3);
             //拼接数据
             array_shift($v);
             $totalconn[] = (int) $v[0];
             $avgdaily[] = (int) $v[1];
             $avghour[] = (int) $v[2];
             $avgtop[] = (int) $v[3];
             $result['y_data'] = array(array('name' => '总连接数', 'data' => $totalconn), array('name' => '日均', 'data' => $avgdaily), array('name' => '平均每小时(/h)', 'data' => $avghour), array('name' => '高峰时段(/h)', 'data' => $avgtop));
         }
         return $result;
     }
     return $res;
 }