Index.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | [ WE CAN DO IT MORE SIMPLE ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2018-2020 rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | [ 首页管理 ]
  8. // +----------------------------------------------------------------------
  9. // | Date: 2020-08-31 20:43
  10. // +----------------------------------------------------------------------
  11. namespace app\system\controller;
  12. use app\BaseController;
  13. use app\model\system\AdminMenu;
  14. use app\model\api\Sys as SysModel;
  15. use app\Request;
  16. use app\system\controller\AuthController;
  17. use library\services\UtilService;
  18. use think\Cache;
  19. class Index extends AuthController
  20. {
  21. /**
  22. * 基本数据
  23. * @return mixed
  24. * @throws \think\db\exception\DataNotFoundException
  25. * @throws \think\db\exception\DbException
  26. * @throws \think\db\exception\ModelNotFoundException
  27. */
  28. public function init()
  29. {
  30. $menuMenu = new AdminMenu;
  31. [$menus, $paths] = $menuMenu->getRoute($this->adminInfo['role_id']);
  32. return app('json')->success([
  33. 'menus' => $menus,
  34. 'paths' => $paths,
  35. 'user_info' => [
  36. 'id' => $this->adminInfo['id'],
  37. 'username' => $this->adminInfo['username'],
  38. 'name' => $this->adminInfo['name'],
  39. 'avatar' => $this->adminInfo['avatar'],
  40. ],
  41. ]);
  42. }
  43. }