修改代码格式,修改系统菜单

This commit is contained in:
Anyon 2019-11-29 11:06:38 +08:00
parent 7dd1b66583
commit b6651deaa6
11 changed files with 42 additions and 19 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@
*.log
runtime
public/upload
/nbproject/private/

View File

@ -25,6 +25,7 @@ use think\admin\service\AdminService;
*/
class Auth extends Controller
{
/**
* 绑定数据表
* @var string

View File

@ -24,6 +24,7 @@ use think\admin\Controller;
*/
class Config extends Controller
{
/**
* 绑定数据表
* @var string
@ -80,7 +81,9 @@ class Config extends Controller
if (!empty($post['storage']['allow_exts'])) {
$exts = array_unique(explode(',', strtolower($post['storage']['allow_exts'])));
sort($exts);
if (in_array('php', $exts)) $this->error('禁止上传可执行文件到本地服务器!');
if (in_array('php', $exts)) {
$this->error('禁止上传可执行文件到本地服务器!');
}
$post['storage']['allow_exts'] = join(',', $exts);
}
foreach ($post as $key => $value) sysconf($key, $value);

View File

@ -27,6 +27,7 @@ use think\admin\service\SystemService;
*/
class Login extends Controller
{
/**
* 后台登录入口
* @throws \think\db\exception\DataNotFoundException

View File

@ -26,6 +26,7 @@ use think\admin\service\MenuService;
*/
class Menu extends Controller
{
/**
* 当前操作数据库
* @var string
@ -100,10 +101,12 @@ class Menu extends Controller
// 选择自己的上级菜单
if (empty($vo['pid']) && $this->request->get('pid', '0')) $vo['pid'] = $this->request->get('pid', '0');
// 列出可选上级菜单
$menus = $this->app->db->name($this->table)->where(['status' => '1'])->order('sort desc,id asc')->column('id,pid,title');
$menus[] = ['title' => '顶部菜单', 'id' => '0', 'pid' => '-1'];
foreach ($this->menus = DataExtend::arr2table($menus) as $key => &$menu) {
if ($menu['spt'] >= 3) unset($this->menus[$key]);
$menus = $this->app->db->name($this->table)->where(['status' => '1'])->order('sort desc,id asc')->column('id,pid,url,title');
$this->menus = DataExtend::arr2table(array_merge($menus, [['id' => '0', 'pid' => '-1', 'url' => '#', 'title' => '顶部菜单']]));
if (isset($vo['id'])) foreach ($this->menus as $key => $menu) if ($menu['id'] === $vo['id']) $vo = $menu;
foreach ($this->menus as $key => &$menu) {
if ($menu['spt'] >= 3 || $menu['url'] !== '#') unset($this->menus[$key]);
if (isset($vo['spt']) && $vo['spt'] <= $menu['spt']) unset($this->menus[$key]);
}
}
}
@ -129,4 +132,5 @@ class Menu extends Controller
$this->_applyFormToken();
$this->_delete($this->table);
}
}

View File

@ -86,4 +86,5 @@ class Oplog extends Controller
$this->_applyFormToken();
$this->_delete($this->table);
}
}

View File

@ -26,6 +26,7 @@ use think\exception\HttpResponseException;
*/
class Queue extends Controller
{
/**
* 绑定数据表
* @var string
@ -74,7 +75,9 @@ class Queue extends Controller
*/
protected function _redo_save_result($state)
{
if ($state) $this->success('重启任务成功!');
if ($state) {
$this->success('重启任务成功!');
}
}
/**

View File

@ -111,7 +111,8 @@ class User extends Controller
// 用户权限处理
$data['authorize'] = (isset($data['authorize']) && is_array($data['authorize'])) ? join(',', $data['authorize']) : '';
// 用户账号重复检查
if (isset($data['id'])) unset($data['username']);
if (isset($data['id']))
unset($data['username']);
elseif ($this->app->db->name($this->table)->where(['username' => $data['username'], 'is_deleted' => '0'])->count() > 0) {
$this->error("账号{$data['username']}已经存在,请使用其它账号!");
}
@ -148,4 +149,5 @@ class User extends Controller
$this->_applyFormToken();
$this->_delete($this->table);
}
}

View File

@ -25,6 +25,7 @@ use think\admin\service\InstallService;
*/
class Update extends Controller
{
/**
* 获取文件列表
*/
@ -41,9 +42,13 @@ class Update extends Controller
public function get()
{
$this->file = $this->app->getRootPath() . decode(input('encode', '0'));
file_exists($this->file) ? $this->success('读取文件成功!', [
'content' => base64_encode(file_get_contents($this->file)),
]) : $this->error('读取文件内容失败!');
if (file_exists($this->file)) {
$this->success('读取文件成功!', [
'content' => base64_encode(file_get_contents($this->file)),
]);
} else {
$this->error('读取文件内容失败!');
}
}
}

View File

@ -25,6 +25,7 @@ use think\admin\Storage;
*/
class Upload extends Controller
{
/**
* 上传安全检查
* @login true
@ -122,4 +123,5 @@ class Upload extends Controller
$this->error(lang($e->getMessage()));
}
}
}