public function searchInfo() { $record_count = new Expression('count(id)'); $start = new Expression("left(column_get(blob_data,'load_date' as datetime),16)"); // $end = new Expression("column_get(blob_data,'load_date' as datetime)"); $query = parent::find()->addSelect(['record_count' => $record_count, 'start' => $start])->groupBy('start'); $ret = $query->all(); // var_dump($ret);die; // $dataProvider = new ActiveDataProvider([ // 'query' => $query, // 'pagination'=>false, // ]); $return['labels'] = ArrayHelper::getColumn($ret, 'start'); $return['data'] = ArrayHelper::getColumn($ret, 'record_count'); // $return['cpu']=shell_exec('rrdtool fetch /var/lib/munin/localhost/localhost-mysql_bytes-recv-d.rrd AVERAGE -r 1m -s -1h'); // var_dump($return['cpu']);die; return $return; }
/** * Finds the Loader model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Loader the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Loader::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }