MainController.php 988 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace merchant\controllers;
  3. use Yii;
  4. /**
  5. * 主控制器
  6. *
  7. * Class MainController
  8. * @package merchant\controllers
  9. * @author jianyan74 <751393839@qq.com>
  10. */
  11. class MainController extends BaseController
  12. {
  13. /**
  14. * @var string
  15. */
  16. public $layout = '@backend/views/layouts/main';
  17. /**
  18. * 系统首页
  19. *
  20. * @return string
  21. */
  22. public function actionIndex()
  23. {
  24. // 触发主题切换
  25. !Yii::$app->params['isMobile'] && Yii::$app->services->theme->autoSwitcher();
  26. // 设置为 AJAX 关闭掉 DEBUG 显示
  27. YII_DEBUG && Yii::$app->request->headers->set('X-Requested-With', 'XMLHttpRequest');
  28. return $this->renderPartial('@backend/views/theme/' . Yii::$app->params['theme']['layout'] . '/index', [
  29. ]);
  30. }
  31. /**
  32. * 子框架默认主页
  33. *
  34. * @return string
  35. */
  36. public function actionHome()
  37. {
  38. return $this->render($this->action->id, [
  39. ]);
  40. }
  41. }
粤ICP备19079148号