Index.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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\api\EducationModel;
  14. use app\model\system\AdminMenu;
  15. use app\model\api\Sys as SysModel;
  16. use app\Request;
  17. use app\system\controller\AuthController;
  18. use library\services\UtilService;
  19. use think\Cache;
  20. use think\db\exception\DataNotFoundException;
  21. use think\db\exception\DbException;
  22. use think\db\exception\ModelNotFoundException;
  23. class Index extends AuthController
  24. {
  25. /**
  26. * 基本数据
  27. * @return mixed
  28. * @throws \think\db\exception\DataNotFoundException
  29. * @throws \think\db\exception\DbException
  30. * @throws \think\db\exception\ModelNotFoundException
  31. */
  32. public function init()
  33. {
  34. $menuMenu = new AdminMenu;
  35. [$menus, $paths] = $menuMenu->getRoute($this->adminInfo['role_id']);
  36. return app('json')->success([
  37. 'menus' => $menus,
  38. 'paths' => $paths,
  39. 'user_info' => [
  40. 'id' => $this->adminInfo['id'],
  41. 'username' => $this->adminInfo['username'],
  42. 'name' => $this->adminInfo['name'],
  43. 'avatar' => $this->adminInfo['avatar'],
  44. ],
  45. ]);
  46. }
  47. }