| 12345678910111213141516171819202122232425 |
- <?php
- namespace backend\controllers;
- use common\components\page;
- use common\models\xhTrainStudent;
- use Yii;
- use yii\web\Controller;
- class ApplyController extends BackendController
- {
- public function actionList()
- {
- $get = Yii::$app->request->get();
- $query = xhTrainStudent::find()->where(['merchantId' => $this->merchantId]);
- $countQuery = clone $query;
- $count = $countQuery->count();
- $page = isset($get['page']) ? $get['page'] : 1;
- $pageSize = 20;
- $offset = ($page - 1) * $pageSize;
- $models = $query->offset($offset)->orderBy('id desc')->limit($pageSize)->asArray()->all();
- $page = new page($count,$page,$pageSize);
- $paging = $page->fpage();
- return $this->render('list',['models'=>$models,'paging'=>$paging]);
- }
- }
|