RechargeConfigController.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace api\modules\v1\controllers\member;
  3. use Yii;
  4. use api\controllers\OnAuthController;
  5. use common\enums\StatusEnum;
  6. use common\models\member\RechargeConfig;
  7. /**
  8. * Class RechargeConfigController
  9. * @package api\modules\v1\controllers\member
  10. * @author jianyan74 <751393839@qq.com>
  11. */
  12. class RechargeConfigController extends OnAuthController
  13. {
  14. /**
  15. * @var RechargeConfig
  16. */
  17. public $modelClass = RechargeConfig::class;
  18. /**
  19. * @return array
  20. */
  21. public function actionIndex()
  22. {
  23. return $this->modelClass::find()
  24. ->where(['status' => StatusEnum::ENABLED])
  25. ->andWhere(['merchant_id' => Yii::$app->services->merchant->getNotNullId()])
  26. ->orderBy('price asc')
  27. ->asArray()
  28. ->all();
  29. }
  30. /**
  31. * 权限验证
  32. *
  33. * @param string $action 当前的方法
  34. * @param null $model 当前的模型类
  35. * @param array $params $_GET变量
  36. * @throws \yii\web\BadRequestHttpException
  37. */
  38. public function checkAccess($action, $model = null, $params = [])
  39. {
  40. // 方法名称
  41. if (in_array($action, ['delete', 'create', 'update', 'view'])) {
  42. throw new \yii\web\BadRequestHttpException('权限不足');
  43. }
  44. }
  45. }
粤ICP备19079148号