DefaultController.php 1017 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace api\modules\v1\controllers;
  3. use api\controllers\OnAuthController;
  4. use common\enums\StatusEnum;
  5. use common\helpers\UploadHelper;
  6. /**
  7. * 默认控制器
  8. *
  9. *
  10. * Class DefaultController
  11. * @package api\modules\v1\controllers
  12. * @property \yii\db\ActiveRecord $modelClass
  13. * @author qimall
  14. */
  15. class DefaultController extends OnAuthController
  16. {
  17. public $modelClass = '';
  18. /**
  19. * 不用进行登录验证的方法
  20. * 例如: ['index', 'update', 'create', 'view', 'delete']
  21. * 默认全部需要验证
  22. *
  23. * @var array
  24. */
  25. protected $authOptional = ['index', 'search'];
  26. /**
  27. * @return string|\yii\data\ActiveDataProvider
  28. */
  29. public function actionIndex()
  30. {
  31. return 'index';
  32. }
  33. /**
  34. * 测试查询方法
  35. *
  36. * 注意:该方法在 main.php 文件里面的 extraPatterns 单独配置过才正常访问
  37. *
  38. * @return string
  39. */
  40. public function actionSearch()
  41. {
  42. return '测试查询';
  43. }
  44. }