mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-08-07 22:29:44 +08:00
修改系统模块
This commit is contained in:
parent
444aa82bad
commit
4bfb7c16c8
@ -45,7 +45,7 @@ class Base extends Controller
|
|||||||
{
|
{
|
||||||
$this->_query(SystemBase::class)->layTable(function () {
|
$this->_query(SystemBase::class)->layTable(function () {
|
||||||
$this->title = '数据字典管理';
|
$this->title = '数据字典管理';
|
||||||
$this->types = (new SystemBase)->types();
|
$this->types = SystemBase::mk()->types();
|
||||||
$this->type = input('get.type') ?: ($this->types[0] ?? '-');
|
$this->type = input('get.type') ?: ($this->types[0] ?? '-');
|
||||||
}, function (QueryHelper $query) {
|
}, function (QueryHelper $query) {
|
||||||
$query->where(['deleted' => 0])->equal('type');
|
$query->where(['deleted' => 0])->equal('type');
|
||||||
@ -84,7 +84,7 @@ class Base extends Controller
|
|||||||
protected function _form_filter(array &$data)
|
protected function _form_filter(array &$data)
|
||||||
{
|
{
|
||||||
if ($this->request->isGet()) {
|
if ($this->request->isGet()) {
|
||||||
$this->types = (new SystemBase)->types();
|
$this->types = SystemBase::mk()->types();
|
||||||
$this->types[] = '--- 新增类型 ---';
|
$this->types[] = '--- 新增类型 ---';
|
||||||
$this->type = input('get.type') ?: ($this->types[0] ?? '-');
|
$this->type = input('get.type') ?: ($this->types[0] ?? '-');
|
||||||
} else {
|
} else {
|
||||||
|
@ -107,7 +107,7 @@ class Index extends Controller
|
|||||||
'oldpassword.require' => '旧的密码不能为空!',
|
'oldpassword.require' => '旧的密码不能为空!',
|
||||||
'password.confirm:repassword' => '两次输入的密码不一致!',
|
'password.confirm:repassword' => '两次输入的密码不一致!',
|
||||||
]);
|
]);
|
||||||
$user = (new SystemUser)->find($id);
|
$user = SystemUser::mk()->find($id);
|
||||||
if (empty($user)) $this->error('用户不存在!');
|
if (empty($user)) $this->error('用户不存在!');
|
||||||
if (md5($data['oldpassword']) !== $user['password']) {
|
if (md5($data['oldpassword']) !== $user['password']) {
|
||||||
$this->error('旧密码验证失败,请重新输入!');
|
$this->error('旧密码验证失败,请重新输入!');
|
||||||
|
@ -121,7 +121,7 @@ class Menu extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* 列出可选上级菜单 */
|
/* 列出可选上级菜单 */
|
||||||
$menus = (new SystemMenu)->order('sort desc,id asc')->column('id,pid,icon,url,node,title,params', 'id');
|
$menus = SystemMenu::mk()->order('sort desc,id asc')->column('id,pid,icon,url,node,title,params', 'id');
|
||||||
$this->menus = DataExtend::arr2table(array_merge($menus, [['id' => '0', 'pid' => '-1', 'url' => '#', 'title' => '顶部菜单']]));
|
$this->menus = DataExtend::arr2table(array_merge($menus, [['id' => '0', 'pid' => '-1', 'url' => '#', 'title' => '顶部菜单']]));
|
||||||
if (isset($vo['id'])) foreach ($this->menus as $menu) if ($menu['id'] === $vo['id']) $vo = $menu;
|
if (isset($vo['id'])) foreach ($this->menus as $menu) if ($menu['id'] === $vo['id']) $vo = $menu;
|
||||||
foreach ($this->menus as $key => $menu) if ($menu['spt'] >= 3 || $menu['url'] !== '#') unset($this->menus[$key]);
|
foreach ($this->menus as $key => $menu) if ($menu['spt'] >= 3 || $menu['url'] !== '#') unset($this->menus[$key]);
|
||||||
|
@ -57,7 +57,7 @@ class User extends Controller
|
|||||||
$this->type = input('type', 'index');
|
$this->type = input('type', 'index');
|
||||||
$this->_query(SystemUser::class)->layTable(function () {
|
$this->_query(SystemUser::class)->layTable(function () {
|
||||||
$this->title = '系统用户管理';
|
$this->title = '系统用户管理';
|
||||||
$this->bases = (new SystemBase)->items('身份权限');
|
$this->bases = SystemBase::mk()->items('身份权限');
|
||||||
}, function (QueryHelper $query) {
|
}, function (QueryHelper $query) {
|
||||||
// 加载对应数据列表
|
// 加载对应数据列表
|
||||||
if ($this->type === 'index') {
|
if ($this->type === 'index') {
|
||||||
@ -77,7 +77,7 @@ class User extends Controller
|
|||||||
*/
|
*/
|
||||||
protected function _page_filter(array &$data)
|
protected function _page_filter(array &$data)
|
||||||
{
|
{
|
||||||
(new SystemBase)->items('身份权限', $data, 'usertype', 'userinfo');
|
SystemBase::mk()->items('身份权限', $data, 'usertype', 'userinfo');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,7 +124,7 @@ class User extends Controller
|
|||||||
'repassword.require' => '重复密码不能为空!',
|
'repassword.require' => '重复密码不能为空!',
|
||||||
'repassword.confirm:password' => '两次输入的密码不一致!',
|
'repassword.confirm:password' => '两次输入的密码不一致!',
|
||||||
]);
|
]);
|
||||||
$user = (new SystemUser)->find($data['id']);
|
$user = SystemUser::mk()->find($data['id']);
|
||||||
if (!empty($user) && $user->save(['password' => md5($data['password'])])) {
|
if (!empty($user) && $user->save(['password' => md5($data['password'])])) {
|
||||||
sysoplog('系统用户管理', "修改用户[{$data['id']}]密码成功");
|
sysoplog('系统用户管理', "修改用户[{$data['id']}]密码成功");
|
||||||
$this->success('密码修改成功,请使用新密码登录!', '');
|
$this->success('密码修改成功,请使用新密码登录!', '');
|
||||||
@ -154,7 +154,7 @@ class User extends Controller
|
|||||||
$this->error('登录账号不能为空!');
|
$this->error('登录账号不能为空!');
|
||||||
}
|
}
|
||||||
$map = ['username' => $data['username'], 'is_deleted' => 0];
|
$map = ['username' => $data['username'], 'is_deleted' => 0];
|
||||||
if ((new SystemUser)->where($map)->count() > 0) {
|
if (SystemUser::mk()->where($map)->count() > 0) {
|
||||||
$this->error("账号已经存在,请使用其它账号!");
|
$this->error("账号已经存在,请使用其它账号!");
|
||||||
}
|
}
|
||||||
// 新添加的用户密码与账号相同
|
// 新添加的用户密码与账号相同
|
||||||
@ -162,7 +162,7 @@ class User extends Controller
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 用户身份数据
|
// 用户身份数据
|
||||||
$this->bases = (new SystemBase)->items('身份权限');
|
$this->bases = SystemBase::mk()->items('身份权限');
|
||||||
// 权限绑定处理
|
// 权限绑定处理
|
||||||
$data['authorize'] = str2arr($data['authorize'] ?? '');
|
$data['authorize'] = str2arr($data['authorize'] ?? '');
|
||||||
// 用户权限管理
|
// 用户权限管理
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
namespace app\admin\model;
|
namespace app\admin\model;
|
||||||
|
|
||||||
use think\Model;
|
use think\admin\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据字典数据模型
|
* 数据字典数据模型
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
namespace app\admin\model;
|
namespace app\admin\model;
|
||||||
|
|
||||||
use think\Model;
|
use think\admin\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统任务数据模型
|
* 系统任务数据模型
|
||||||
|
Loading…
x
Reference in New Issue
Block a user