<?php
namespace Addons\QyWechat\Controller\Admin;

use Lib\Response;

class BaseAdmin extends \BaseController
{
    protected $wid;
    public function _initialize()
    {
        $this->wid=\Session::get("wid");
        if(!$this->wid){
            $this->abortError(error("无权访问此页面"),'json',403);
        }
        $this->assign("title","企微魔盒");
        parent::_initialize(); // TODO: Change the autogenerated stub

    }


    /**
     * 发送信息到客户端并退出
     * @param $data
     * @param string $type
     * @param int $http_status
     */
    public function abortError($data,$type='json',$http_status=200){
        Response::create($data,$type,$http_status)->send();
        $this->afterAction();
        exit(0);
    }
    public function afterAction()
    {
        $this->__destruct();
    }
    public function __destruct()
    {
        // TODO: Implement __destruct() method.
    }
}
