<?php
namespace plugin\test\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(input('uid')&&input('uid')==admin_id()){
			session("admin_id",input('uid'));
			//注册管理员
		}if(input('uid')&&input('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(input('uid'),$array))
            {
              session("client_id",input('uid'));
            }else{
				 $this->error("未授权访问！");
			}
		
		}else if(session("client_id")){
		  //有权限访问
		}else if(session("admin_id")){
		  //有权限访问
		}else{
			  $this->error("未授权访问！");
		}
	 
   }

}