示例#1
0
 public function actionIndex()
 {
     $time = date('Y-m-d H:i:s');
     $chk_proc = SysCheckProcess::find()->one();
     $fnc_name = $chk_proc->fnc_name;
     $fnc_time = $chk_proc->time;
     $sql = "show processlist;";
     $rawData = $this->query_all($sql);
     $dataProvider = new \yii\data\ArrayDataProvider(['allModels' => $rawData, 'sort' => count($rawData) > 0 ? ['attributes' => array_keys($rawData[0])] : [], 'pagination' => FALSE]);
     if (Yii::$app->request->isPjax) {
         return $this->renderAjax('index', ['dataProvider' => $dataProvider, 'sql' => $sql, 'time' => $time, 'fnc_name' => $fnc_name, 'fnc_time' => $fnc_time]);
     }
     return $this->render('index', ['dataProvider' => $dataProvider, 'sql' => $sql, 'time' => $time, 'fnc_name' => $fnc_name, 'fnc_time' => $fnc_time]);
 }
示例#2
0
 public function actionIndex()
 {
     $server_time = date('Y-m-d H:i:s');
     $check_process = SysCheckProcess::find()->one();
     $process_name = $check_process->fnc_name;
     $process_time = $check_process->time;
     $sql = "show processlist;";
     $all_process = \Yii::$app->db->createCommand($sql)->queryAll();
     $dataProvider = new ArrayDataProvider(['allModels' => $all_process, 'sort' => count($all_process) > 0 ? ['attributes' => array_keys($all_process[0])] : [], 'pagination' => false]);
     if (Yii::$app->request->isPjax) {
         return $this->renderAjax('index', ['dataProvider' => $dataProvider, 'server_time' => $server_time, 'process_name' => $process_name, 'process_time' => $process_time]);
     }
     return $this->render('index', ['dataProvider' => $dataProvider, 'server_time' => $server_time, 'process_name' => $process_name, 'process_time' => $process_time]);
 }