<?php
// +----------------------------------------------------------------------
// | [ WE CAN DO IT MORE SIMPLE  ]
// +----------------------------------------------------------------------
// | Copyright (c) 2018-2020 rights reserved.
// +----------------------------------------------------------------------
// | [ 首页管理 ]
// +----------------------------------------------------------------------
// | Date: 2020-08-31 20:43
// +----------------------------------------------------------------------

namespace app\system\controller;


use app\BaseController;
use app\model\system\AdminMenu;
use app\model\api\Sys as SysModel;
use app\Request;
use app\system\controller\AuthController;
use library\services\UtilService;
use think\Cache;

class Index extends AuthController
{

    /**
     * 基本数据
     * @return mixed
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function init()
    {
        $menuMenu = new AdminMenu;
        [$menus, $paths] = $menuMenu->getRoute($this->adminInfo['role_id']);
        return app('json')->success([
            'menus'     => $menus,
            'paths'     => $paths,
            'user_info' => [
                'id'       => $this->adminInfo['id'],
                'username' => $this->adminInfo['username'],
                'name'     => $this->adminInfo['name'],
                'avatar'   => $this->adminInfo['avatar'],
            ],
        ]);
    }
}