Index.php 673 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace app\store\controller;
  3. use app\store\model\Store as StoreModel;
  4. /**
  5. * 后台首页
  6. * Class Index
  7. * @package app\store\controller
  8. */
  9. class Index extends Controller
  10. {
  11. /**
  12. * 后台首页
  13. * @return mixed
  14. * @throws \think\Exception
  15. * @throws \think\exception\DbException
  16. */
  17. public function index()
  18. {
  19. // 当前用户菜单url
  20. $menus = $this->menus();
  21. $url = current(array_values($menus))['index'];
  22. if ($url !== 'index/index') {
  23. $this->redirect($url);
  24. }
  25. $model = new StoreModel;
  26. return $this->fetch('index', ['data' => $model->getHomeData()]);
  27. }
  28. }