重新初始化

This commit is contained in:
2020-02-17 20:47:06 +08:00
parent 5c320206fb
commit 58d999ed73
4016 changed files with 1271 additions and 302396 deletions

View File

@@ -9,8 +9,6 @@
namespace app\controller\admin;
use app\controller\Admin;
use app\model\Menu;
use think\facade\Session;
/**
* @title 后端公共模块
@@ -18,75 +16,26 @@ use think\facade\Session;
class Index extends Admin {
/**
* @title 系统首页
* @title 后台首页
* @return html [description]
*/
public function index(Menu $menu) {
$this->data['data'] = array('menu' => $menu->getAuthMenuList($this->request));
return $this->data;
public function index() {
return $this->fetch();
}
/**
* @title 系统首页
*/
public function dashboard() {
}
/**
* @title 更新缓存
*/
public function clear() {
if ($this->request->isAjax()) {
$root = app()->getRootPath() . 'runtime/';
$this->delDirAndFile($root);
return $this->success('更新成功!');
}
}
/** 递归删除文件
* @param $dirName
* @param bool $subdir
*/
protected function delDirAndFile($dirName) {
$list = glob($dirName . '*');
foreach ($list as $file) {
if (is_dir($file)) {
$this->delDirAndFile($file . '/');
} else {
@unlink($file);
}
}
@rmdir($dirName);
}
/**
* @title 后台登录
* @return html [description]
*/
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;
}
public function login() {
return $this->fetch();
}
/**
* @title 后台
* @title 后台退
* @return html [description]
*/
public function logout() {
Session::set('user', null);
$this->data['code'] = 0;
$this->data['msg'] = "成功退出!";
return $this->data;
return $this->fetch();
}
}
}