Index.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. class Index extends AuthController
  21. {
  22. /**
  23. * 基本数据
  24. * @return mixed
  25. * @throws \think\db\exception\DataNotFoundException
  26. * @throws \think\db\exception\DbException
  27. * @throws \think\db\exception\ModelNotFoundException
  28. */
  29. public function init()
  30. {
  31. $menuMenu = new AdminMenu;
  32. [$menus, $paths] = $menuMenu->getRoute($this->adminInfo['role_id']);
  33. return app('json')->success([
  34. 'menus' => $menus,
  35. 'paths' => $paths,
  36. 'user_info' => [
  37. 'id' => $this->adminInfo['id'],
  38. 'username' => $this->adminInfo['username'],
  39. 'name' => $this->adminInfo['name'],
  40. 'avatar' => $this->adminInfo['avatar'],
  41. ],
  42. ]);
  43. }
  44. //获取所有分类列表
  45. public function getCateList()
  46. {
  47. $cateList = EducationModel::select();
  48. return json($cateList);
  49. }
  50. }