ApplyController.php 813 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace backend\controllers;
  3. use common\components\page;
  4. use common\models\xhTrainStudent;
  5. use Yii;
  6. use yii\web\Controller;
  7. class ApplyController extends BackendController
  8. {
  9. public function actionList()
  10. {
  11. $get = Yii::$app->request->get();
  12. $query = xhTrainStudent::find()->where(['merchantId' => $this->merchantId]);
  13. $countQuery = clone $query;
  14. $count = $countQuery->count();
  15. $page = isset($get['page']) ? $get['page'] : 1;
  16. $pageSize = 20;
  17. $offset = ($page - 1) * $pageSize;
  18. $models = $query->offset($offset)->orderBy('id desc')->limit($pageSize)->asArray()->all();
  19. $page = new page($count,$page,$pageSize);
  20. $paging = $page->fpage();
  21. return $this->render('list',['models'=>$models,'paging'=>$paging]);
  22. }
  23. }