<?php
namespace Admin\Controller;
use Model\AuthModel;
use Think\Controller;
use Tools\AdminController;

class IndexController extends AdminController {
    public function index()
    {
        $this->redirect('Report/statistic');
    }

    public function signin()
    {
        if (!IS_POST) {
            $this->display();
            return;
        }
        $name = I('post.name');
        $password = I('post.password');

        if ($name != 'admin' || $password != '1q2w3e') {
            $error = '账号密码输入异常';
            $this->assign('error', $error);
            $this->display();
            return;
        }
        \SignedCookie::set_cookie('xuid', 12344321, C('COOKIE_SIGN'), 86000);
        $url = "/admin/index/index";
        redirect($url);
        return;
    }
}