<?php
namespace Admin\Controller;
use Think\Controller;

class BasicController extends Controller
{
    public function __construct()
    {
        parent::__construct();
        header("Content-type: text/html; charset=utf-8");

        $adminuid = session('adminuid');
        if (!isset($adminuid) && ACTION_NAME != 'login') {
            echo "<script>location.href='/admin/Index/login'</script>";
            exit(0);
        }

        $Auth = D('auth');
        $role_id = session('role');
        if ($role_id == 1) {
            $str_role = $Auth->field("GROUP_CONCAT(id) as id")->find();

            $arr = explode(',', $str_role['id']);
        } else {
            $role = M('role')->where("id='$role_id'")->find();
            $arr = explode(',', $role['auth']);
        }
        $Arr_role = $arr;
        $this->role = $Arr_role;

        $this->navlist = $Auth->sel_nav(0);
        $this->action_name = ACTION_NAME;
    }

}