<?php

namespace app\admin\controller;

use app\admin\common\AdminController;

/**
 * Description of Menu
 *
 * @author sgq
 */
class Menu extends AdminController {

    /**
     * 树形
     * @return type
     */
    function treelist() {
        $id = $this->request->param("id");
        $list = getTreeList(\app\common\api\MenuApi::getPrivilagesByRoleid($id));
        $format_list = [];
        foreach ($list as $item) {
            $format_list[] = [
                "checked" => $item["checked"],
                "id" => $item["id"],
                "isOpen" => true,
                "name" => $item["name"],
                "open" => $item["pid"] == 0 ? true : false,
                "pId" => $item["pid"]
            ];
        }
        return $format_list;
    }

}
