mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-06 18:12:50 +08:00
feat: 增加姓名字段;修改登录账号为可修改;
This commit is contained in:
@@ -84,6 +84,9 @@ class AdminBase extends AdminController
|
||||
$post['password'] = password(sysconfig('site', 'site_default_password', '123456'));
|
||||
$this->validate($post, $rule);
|
||||
|
||||
if (empty($post['nickname'])) {
|
||||
$post['nickname'] = $post['username'];
|
||||
}
|
||||
try {
|
||||
$model_admin = SystemAdmin::where('username', $post['username'])->find();
|
||||
|
||||
@@ -117,11 +120,21 @@ class AdminBase extends AdminController
|
||||
if (isset($row['password'])) {
|
||||
unset($row['password']);
|
||||
}
|
||||
if (empty($post['nickname'])) {
|
||||
$post['nickname'] = $post['username'];
|
||||
}
|
||||
try {
|
||||
$model_admin = SystemAdmin::where('username', $post['username'])
|
||||
->where('id', '<>', $id)
|
||||
->find();
|
||||
if (!empty($model_admin)) {
|
||||
throw new \Exception('同名用户已存在');
|
||||
}
|
||||
|
||||
$save = $row->save($post);
|
||||
TriggerService::updateMenu($id);
|
||||
} catch (\Exception $e) {
|
||||
$this->error('保存失败');
|
||||
$this->error('保存失败:' . $e->getMessage());
|
||||
}
|
||||
$save ? $this->success('保存成功') : $this->error('保存失败');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user