62 lines
1.4 KiB
PHP
62 lines
1.4 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
|
// +----------------------------------------------------------------------
|
|
namespace app\controller\admin;
|
|
|
|
use app\controller\Admin;
|
|
use think\facade\Session;
|
|
|
|
/**
|
|
* @title 后端公共模块
|
|
*/
|
|
class Index extends Admin{
|
|
|
|
/**
|
|
* @title 系统首页
|
|
*/
|
|
public function index(){
|
|
}
|
|
|
|
/**
|
|
* @title 更新缓存
|
|
*/
|
|
public function clear(){
|
|
}
|
|
|
|
/**
|
|
* @title 后台登录
|
|
*/
|
|
public function login(\app\model\Member $member){
|
|
if ($this->request->isAjax()) {
|
|
$username = $this->request->param('username', '');
|
|
$password = $this->request->param('password', '');
|
|
$user = $member->login($username, $password);
|
|
if ($user) {
|
|
Session::set('user', $user);
|
|
$this->data['url'] = "/admin/index/index.html";
|
|
$this->data['msg'] = "登录成功!";
|
|
}else{
|
|
Session::set('user', null);
|
|
$this->data['code'] = 1;
|
|
$this->data['msg'] = "登录失败!";
|
|
}
|
|
|
|
return $this->data;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @title 后台登出
|
|
*/
|
|
public function logout(){
|
|
Session::set('user', null);
|
|
$this->data['code'] = 0;
|
|
return $this->data;
|
|
}
|
|
}
|