<?php

namespace User\Lib;

use Dever;

class Core
{
    protected $uid = -1;
    protected $login = true;
    public $data = array();

    public function __construct()
    {
        $this->uid = Dever::load('user/lib/info')->check();
        if ($this->uid <= 0) {
            $this->uid = 1;
        }
        $this->user = Dever::db('user/lib/info')->get($this->uid);

        if ($this->user) {
            $this->user['uid'] = $this->user['id'];
        }
        if ($this->login) {
        	$this->checkLogin();
        }
    }

    public function checkLogin()
    {
        if (!$this->uid || $this->uid <= 0) {
            Dever::alert('请先登录', -2);
        }
    }
}