Esempio n. 1
0
 /**
  * echarts api数据接口
  * @return type
  */
 public function actionApi()
 {
     \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     //获得调用的方法
     $fc = \Yii::$app->request->get('fc');
     if (!empty($fc)) {
         switch ($fc) {
             case 'twodayfit':
                 $dataLists = \backend\services\ZabbixHightchartService::fitTwoDay();
                 return $dataLists;
             case 'detail':
                 $dataLists = \backend\services\ZabbixHightchartService::fitDetailData();
                 return $dataLists;
             default:
         }
     }
     $id = \Yii::$app->request->get('id');
     if (empty($id)) {
         return [];
     }
     //配置选择的时间
     $date = \Yii::$app->request->get('date');
     if (empty($date)) {
         $sDate = date('Y-m-d 00:00:00');
         $eDate = date('Y-m-d H:i:s');
     } else {
         $sDate = date('Y-m-d 00:00:00', strtotime($date));
         $eDate = date('Y-m-d 00:00:00', strtotime("+1 day", strtotime($date)));
     }
     if (strtotime($eDate) > time()) {
         $eDate = date('Y-m-d H:i:s');
     }
     //获得相应数据
     $datlists = \backend\services\ZabbixHightchartService::findSelectColumnFit($id, $sDate, $eDate);
     return $datlists;
 }
Esempio n. 2
0
 /**
  * 处理地图信息
  */
 public function actionApi()
 {
     \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     //获得调用的方法
     $fc = \Yii::$app->request->get('fc');
     if (!empty($fc)) {
         switch ($fc) {
             case 'chinamap':
                 $dataLists = \backend\services\NginxHightchartService::fitChinaMap();
                 return $dataLists;
             case 'worldmap':
                 $dataLists = \backend\services\NginxHightchartService::fitWorldMap();
                 return $dataLists;
             case 'plat_brower':
                 $dataLists = \backend\services\NginxHightchartService::fitPlatBrower();
                 return $dataLists;
             case 'errorstatus':
                 $dataLists = \backend\services\NginxHightchartService::fitErrors();
                 return $dataLists;
             case 'mobilebrower':
                 $dataLists = \backend\services\NginxHightchartService::fitMobilebrower();
                 return $dataLists;
             case 'totalvisit':
                 $dataLists = \backend\services\NginxHightchartService::fitTotalVisit();
                 return $dataLists;
             case 'latevisit':
                 $dataLists = \backend\services\NginxHightchartService::fitLateVisit();
                 return $dataLists;
             default:
         }
     }
     $id = \Yii::$app->request->get('id');
     if (empty($id)) {
         return [];
     }
     //配置选择的时间
     $date = \Yii::$app->request->get('date');
     if (empty($date)) {
         $sDate = date('Y-m-d 00:00:00');
         $eDate = date('Y-m-d H:i:s');
     } else {
         $sDate = date('Y-m-d 00:00:00', strtotime($date));
         $eDate = date('Y-m-d 00:00:00', strtotime("+1 day", strtotime($date)));
     }
     if (strtotime($eDate) > time()) {
         $eDate = date('Y-m-d H:i:s');
     }
     //获得相应数据
     $datlists = \backend\services\ZabbixHightchartService::findSelectColumnFit($id, $sDate, $eDate);
     return $datlists;
 }