user(); AdminLogsServer::write(empty($user->id)?0:$user->id,'后台访问日志记录'); // // 判断当前会员是否具有权限 $clientRoute = request()->route()->getName(); // $p_num=\App\Models\Permission::where('routes',$clientRoute)->count(); // if($p_num<=0){ // \App\Models\Permission::create(['routes'=>$clientRoute,'name'=>$clientRoute,'sort'=>1,'p_id'=>1,'type'=>'3']); // } if(in_array($clientRoute,['login','admin.index.ajax','admin.not.permission','admin.index','admin.ajaxIndex','admin.switch','admin.u_sort']) || $user->{"id"}==1){ return $next($request); } $date_time=date('Hi'); // if( $date_time<800){ // echo 'end';exit; // return redirect()->route('admin.not.permission'); // } // dd($clientRoute); $ret=PermissionServer::verifyPermission($user->{'id'},$clientRoute); if ( empty($ret) ) { $is_ajax=request()->ajax(); if($is_ajax){ return response()->json([ 'status' => 'error', 'message' => '暂无权限', 'redirect' => '', 'callback' => '', 'data' => [] ]); }else{ // 当前会员没有权限 return redirect()->route('admin.not.permission'); } } return $next($request); } }