BankNumberController.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace api\modules\v1\controllers\common;
  3. use yii\data\ActiveDataProvider;
  4. use api\controllers\OnAuthController;
  5. use common\enums\StatusEnum;
  6. use common\models\common\BankNumber;
  7. /**
  8. * Class BankNumberController
  9. * @package api\modules\v1\controllers\common
  10. * @author jianyan74 <751393839@qq.com>
  11. */
  12. class BankNumberController extends OnAuthController
  13. {
  14. /**
  15. * @var BankNumber
  16. */
  17. public $modelClass = BankNumber::class;
  18. /**
  19. * 首页
  20. *
  21. * @return ActiveDataProvider
  22. */
  23. public function actionIndex()
  24. {
  25. return new ActiveDataProvider([
  26. 'query' => $this->modelClass::find()
  27. ->where(['status' => StatusEnum::ENABLED])
  28. ->orderBy('bank_number asc')
  29. ->asArray(),
  30. 'pagination' => [
  31. 'pageSize' => $this->pageSize,
  32. 'validatePage' => false,// 超出分页不返回data
  33. ],
  34. ]);
  35. }
  36. /**
  37. * 权限验证
  38. *
  39. * @param string $action 当前的方法
  40. * @param null $model 当前的模型类
  41. * @param array $params $_GET变量
  42. * @throws \yii\web\BadRequestHttpException
  43. */
  44. public function checkAccess($action, $model = null, $params = [])
  45. {
  46. // 方法名称
  47. if (in_array($action, ['update', 'create', 'delete'])) {
  48. throw new \yii\web\BadRequestHttpException('权限不足');
  49. }
  50. }
  51. }
粤ICP备19079148号