<?php

namespace App\Http\Controllers\API\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Services\Admin\MenuService;
use App\Services\Admin\UserService;

class BaseInfoController extends Controller
{
    //登录后获取admin后台自身菜单列表
    public function GetBaseMenuList(Request $request){
        $userid = $request->get('userid');//中间件产生的参数
        $group = $request->get('role');//中间件产生的参数
        $s=app()->make(MenuService::class);
       // dd($s->GetBaseMenuList(['userid'=>$userid,'group'=>$group]));
        return $s->GetBaseMenuList(['userid'=>$userid,'group'=>$group]);

    }
    //获取自身基本信息
    public function GetBaseUserInfo(Request $request){
        $userid = $request->get('userid');//中间件产生的参数
        $group = $request->get('role');//中间件产生的参数
        $s=app()->make(UserService::class);
        return  $s->GetDetail(['id'=>$userid]);

    }

    //检查用户是否有某个目录的权限
    public function CheckMenuAuth(Request $request){
        $userid = $request->get('userid');//中间件产生的参数
        $group = $request->get('role');//中间件产生的参数
        $url= request('url');
        $s=app()->make(UserService::class);
        return  $s->CheckMenuAuth(['userid'=>$userid,'group'=>$group,'url'=>$url]);
    }
}
