public function actionList($class_id = ‘‘) { $data = Article::find(); if ($class_id) { $data->andWhere([ ‘class_id‘ => $class_id ]); } $pages = new Pagination([ ‘totalCount‘ => $data->count(), ‘pageSize‘ => 30 ]); $model = $data->offset($pages->offset)->limit($pages->limit)->all(); return $this->render(‘list‘, [ ‘model‘ => $model, ‘pages‘ => $pages, ]); }
时间: 2024-10-09 18:18:00