<?php
namespace plugin\[SPACE]\controller;
use think\Controller;
use think\Db;
use think\facade\Session;
class Admin extends Controller{

   public function initialize(){ 
          Session::init([
          'prefix'         =>'admin_',
          'type'           => '',
          'auto_start'     => true,
        ]);
		$uid=is_login();
		//判断是否管理员
		if($uid&&$uid==admin_id()){
			session("admin_id",$uid);
			//注册管理员
		}if($uid&&$uid!=admin_id()){
			$name=input("_p");
			$map['name']=$name;
			$map['status']=1;
	        $ids=Db::name("plugin")->where($map)->value('ids');
			$array=explode("|",$ids);
			if (in_array($uid,$array))
            {
              session("client_id",$uid);
            }else{
				 $this->error("未授权访问！");
			}
		
		}else if(session("client_id")){
		  //有权限访问
		}else if(session("admin_id")){
		  //有权限访问
		}else{
			  $this->error("未授权访问！");
		}
	 
   }

}