DefaultController.php 920 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace oauth2\modules\v1\controllers;
  3. use Yii;
  4. use oauth2\controllers\OnAuthController;
  5. /**
  6. * 默认控制器
  7. *
  8. * Class DefaultController
  9. * @package oauth2\modules\v1\controllers
  10. * @property \yii\db\ActiveRecord $modelClass
  11. * @author jianyan74 <751393839@qq.com>
  12. */
  13. class DefaultController extends OnAuthController
  14. {
  15. public $modelClass = '';
  16. /**
  17. * 不用进行登录验证的方法
  18. * 例如: ['index', 'update', 'create', 'view', 'delete']
  19. * 默认全部需要验证
  20. *
  21. * @var array
  22. */
  23. protected $authOptional = ['search'];
  24. /**
  25. * @return \yii\data\ActiveDataProvider|\yii\web\IdentityInterface|null
  26. */
  27. public function actionIndex()
  28. {
  29. return Yii::$app->user->identity;
  30. }
  31. /**
  32. * 测试查询方法
  33. *
  34. * @return string
  35. */
  36. public function actionSearch()
  37. {
  38. return '测试查询';
  39. }
  40. }
粤ICP备19079148号