Test.php 在插件核心安装卸载控制器该文件下
生成后台管理菜单及会议后台菜单

/**
     * 插件安装方法
     * @return bool
     */
    public function install()
    {
        $menu = array(
            "backend" => array(
                ['id'=>'TEST1','name'=>'测试','parent_id'=>'0','icon'=>'iconfont iconfont-kongjian text-primary','uri'=>'addon/test/index','type'=>'0','sort'=>'12'],
                ['id'=>'TEST11','name'=>"测试菜单",'parent_id'=>'TEST1','icon'=>'','uri'=>'addon/test/add','type'=>'0','sort'=>'12']
            ),
            "member" => array(
                ['id'=>'TEST3','name'=>'财务中心','parent_id'=>'0','group_id'=>'2','icon'=>'icon-cny','uri'=>'member/cost','type'=>'0','sort'=>'3'],
                ['id'=>'TEST31','name'=>'账户总览','parent_id'=>'TEST3','icon'=>'','uri'=>'member/cost','type'=>'1','sort'=>'1'],
                ['id'=>'TEST32','name'=>'交易订单','parent_id'=>'TEST3','icon'=>'','uri'=>'member/account','type'=>'1','sort'=>'1'],
            ),
        );
        $this->load->service("menu_service");
        $this->menu_service->create($menu);
        return true;
    }

    /**
     * 插件卸载方法
     * @return bool
     */
    public function uninstall()
    {
        $this->load->service("menu_service");
        $this->menu_service->delete();
        return true;
    }

    /**
     * 插件启用方法
     * @return bool
     */
    public function enable()
    {
        $this->load->service("menu_service");
        $this->menu_service->enable();
        return true;
    }

    /**
     * 插件禁用方法
     * @return bool
     */
    public function disable()
    {
        $this->load->service("menu_service");
        $this->menu_service->disable();
        return true;
    }

backend 为管理后台菜单
member 为会员中心菜单
为避免冲突请在ID前加上全大写插件名
group_id 1为产品组菜单 2为会员组菜单
请在安装 卸载 启用 禁用时都对菜单做相应处理

文档更新时间: 2023-07-05 17:06   作者:carlos