1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- declare (strict_types = 1);
- /**
- * +----------------------------------------------------------------------
- * | 后台登录控制制器
- * +----------------------------------------------------------------------
- */
- namespace app\controller\sys;
- // 引入框架内置类
- use think\facade\View;
- use think\facade\Session;
- use think\facade\Request;
- use think\captcha\facade\Captcha;
- use app\utils\ReUtils;
- use app\model\SysUser;
- use app\model\SysLoginFail;
- use app\model\SysLoginNote;
- class Login
- {
- // 登录页面
- public function index()
- {
- // 已登录自动跳转
- if (Session::has('adminuser')) {
- return redirect((string)url('/sys/index/index'));
- }
- $restore_url = Session::has('restore') ? Session::get('restore'): (string)url('index/index');
- View::assign('restore_url', $restore_url);
- return View::fetch();
- }
- // 校验登录
- public function checkLogin(){
- return SysUser::checkLogin();
- }
- // 退出登录
- public function logout(){
- Session::delete('adminuser');
- return redirect((string) url('login/index'));
- }
- }
|