mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-05 19:41:44 +08:00
修改代码格式,修改系统菜单
This commit is contained in:
parent
7dd1b66583
commit
b6651deaa6
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@
|
|||||||
*.log
|
*.log
|
||||||
runtime
|
runtime
|
||||||
public/upload
|
public/upload
|
||||||
|
/nbproject/private/
|
@ -25,6 +25,7 @@ use think\admin\service\AdminService;
|
|||||||
*/
|
*/
|
||||||
class Auth extends Controller
|
class Auth extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 绑定数据表
|
* 绑定数据表
|
||||||
* @var string
|
* @var string
|
||||||
@ -141,4 +142,4 @@ class Auth extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ use think\admin\Controller;
|
|||||||
*/
|
*/
|
||||||
class Config extends Controller
|
class Config extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 绑定数据表
|
* 绑定数据表
|
||||||
* @var string
|
* @var string
|
||||||
@ -80,11 +81,13 @@ class Config extends Controller
|
|||||||
if (!empty($post['storage']['allow_exts'])) {
|
if (!empty($post['storage']['allow_exts'])) {
|
||||||
$exts = array_unique(explode(',', strtolower($post['storage']['allow_exts'])));
|
$exts = array_unique(explode(',', strtolower($post['storage']['allow_exts'])));
|
||||||
sort($exts);
|
sort($exts);
|
||||||
if (in_array('php', $exts)) $this->error('禁止上传可执行文件到本地服务器!');
|
if (in_array('php', $exts)) {
|
||||||
|
$this->error('禁止上传可执行文件到本地服务器!');
|
||||||
|
}
|
||||||
$post['storage']['allow_exts'] = join(',', $exts);
|
$post['storage']['allow_exts'] = join(',', $exts);
|
||||||
}
|
}
|
||||||
foreach ($post as $key => $value) sysconf($key, $value);
|
foreach ($post as $key => $value) sysconf($key, $value);
|
||||||
$this->success('修改文件存储成功!');
|
$this->success('修改文件存储成功!');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -144,4 +144,4 @@ class Index extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ use think\admin\service\SystemService;
|
|||||||
*/
|
*/
|
||||||
class Login extends Controller
|
class Login extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 后台登录入口
|
* 后台登录入口
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
@ -100,4 +101,4 @@ class Login extends Controller
|
|||||||
$this->success('退出登录成功!', url('@admin/login')->build());
|
$this->success('退出登录成功!', url('@admin/login')->build());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ use think\admin\service\MenuService;
|
|||||||
*/
|
*/
|
||||||
class Menu extends Controller
|
class Menu extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前操作数据库
|
* 当前操作数据库
|
||||||
* @var string
|
* @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');
|
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 = $this->app->db->name($this->table)->where(['status' => '1'])->order('sort desc,id asc')->column('id,pid,url,title');
|
||||||
$menus[] = ['title' => '顶部菜单', 'id' => '0', 'pid' => '-1'];
|
$this->menus = DataExtend::arr2table(array_merge($menus, [['id' => '0', 'pid' => '-1', 'url' => '#', 'title' => '顶部菜单']]));
|
||||||
foreach ($this->menus = DataExtend::arr2table($menus) as $key => &$menu) {
|
if (isset($vo['id'])) foreach ($this->menus as $key => $menu) if ($menu['id'] === $vo['id']) $vo = $menu;
|
||||||
if ($menu['spt'] >= 3) unset($this->menus[$key]);
|
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->_applyFormToken();
|
||||||
$this->_delete($this->table);
|
$this->_delete($this->table);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
@ -86,4 +86,5 @@ class Oplog extends Controller
|
|||||||
$this->_applyFormToken();
|
$this->_applyFormToken();
|
||||||
$this->_delete($this->table);
|
$this->_delete($this->table);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
@ -26,6 +26,7 @@ use think\exception\HttpResponseException;
|
|||||||
*/
|
*/
|
||||||
class Queue extends Controller
|
class Queue extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 绑定数据表
|
* 绑定数据表
|
||||||
* @var string
|
* @var string
|
||||||
@ -74,7 +75,9 @@ class Queue extends Controller
|
|||||||
*/
|
*/
|
||||||
protected function _redo_save_result($state)
|
protected function _redo_save_result($state)
|
||||||
{
|
{
|
||||||
if ($state) $this->success('重启任务成功!');
|
if ($state) {
|
||||||
|
$this->success('重启任务成功!');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,4 +122,4 @@ class Queue extends Controller
|
|||||||
$this->_delete($this->table);
|
$this->_delete($this->table);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,8 @@ class User extends Controller
|
|||||||
// 用户权限处理
|
// 用户权限处理
|
||||||
$data['authorize'] = (isset($data['authorize']) && is_array($data['authorize'])) ? join(',', $data['authorize']) : '';
|
$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) {
|
elseif ($this->app->db->name($this->table)->where(['username' => $data['username'], 'is_deleted' => '0'])->count() > 0) {
|
||||||
$this->error("账号{$data['username']}已经存在,请使用其它账号!");
|
$this->error("账号{$data['username']}已经存在,请使用其它账号!");
|
||||||
}
|
}
|
||||||
@ -148,4 +149,5 @@ class User extends Controller
|
|||||||
$this->_applyFormToken();
|
$this->_applyFormToken();
|
||||||
$this->_delete($this->table);
|
$this->_delete($this->table);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
@ -25,6 +25,7 @@ use think\admin\service\InstallService;
|
|||||||
*/
|
*/
|
||||||
class Update extends Controller
|
class Update extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文件列表
|
* 获取文件列表
|
||||||
*/
|
*/
|
||||||
@ -41,9 +42,13 @@ class Update extends Controller
|
|||||||
public function get()
|
public function get()
|
||||||
{
|
{
|
||||||
$this->file = $this->app->getRootPath() . decode(input('encode', '0'));
|
$this->file = $this->app->getRootPath() . decode(input('encode', '0'));
|
||||||
file_exists($this->file) ? $this->success('读取文件成功!', [
|
if (file_exists($this->file)) {
|
||||||
'content' => base64_encode(file_get_contents($this->file)),
|
$this->success('读取文件成功!', [
|
||||||
]) : $this->error('读取文件内容失败!');
|
'content' => base64_encode(file_get_contents($this->file)),
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$this->error('读取文件内容失败!');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ use think\admin\Storage;
|
|||||||
*/
|
*/
|
||||||
class Upload extends Controller
|
class Upload extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传安全检查
|
* 上传安全检查
|
||||||
* @login true
|
* @login true
|
||||||
@ -122,4 +123,5 @@ class Upload extends Controller
|
|||||||
$this->error(lang($e->getMessage()));
|
$this->error(lang($e->getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user