<?php
/**
 * Created by PhpStorm
 * User：林志杰
 * Email：598287049@qq.com
 * Motto：纵有疾风起，人生不言弃！
 * Time：2020/1/3 23:30
 */

namespace app\admin\controller;


use app\BaseController;
use think\exception\HttpResponseException;

class AdminBase extends BaseController
{
    public $adminUser = null;

    public function initialize()
    {
        parent::initialize();
        // 判断是否登录  判断是否登陆 切换到 中间件Auth中
//        if (!$this->isLogin()) {
//            return $this->redirect(url('login/index'), 302);
//        }
    }

    /**
     * 判断是否登录
     * @return bool
     */
    public function isLogin()
    {
        $this->adminUser = session(config('admin.session_admin'));
        if (empty($this->adminUser)) {
            return false;
        }
        return true;
    }

    public function redirect(...$args)
    {
        throw new HttpResponseException(redirect(...$args));
    }
}