<?php

namespace Agent\Lib;

use Dever;

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

    public function __construct()
    {
        $this->uid = Dever::load('passport/user')->check(false);
        if ($this->uid <= 0) {
            $this->uid = 1000000;
        }
        $this->checkLogin();
        if ($this->uid) {
            $this->user = Dever::db('agent/member')->find($this->uid);
        }

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

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