mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-09-03 06:31:37 +08:00
feat: 增加姓名字段;修改登录账号为可修改;
This commit is contained in:
@@ -60,15 +60,25 @@ class IndexBase extends AdminController
|
||||
$this->isDemo && $this->error('演示环境下不允许修改');
|
||||
$rule = [];
|
||||
$this->validate($post, $rule);
|
||||
if (empty($post['nickname'])) {
|
||||
$post['nickname'] = $row['username'];
|
||||
}
|
||||
try {
|
||||
$model_admin = SystemAdmin::where('username', $post['username'])
|
||||
->where('id', '<>', $id)
|
||||
->find();
|
||||
if (!empty($model_admin)) {
|
||||
throw new \Exception('同名用户已存在');
|
||||
}
|
||||
|
||||
$save = $row
|
||||
->allowField(['head_img', 'phone', 'remark', 'update_time'])
|
||||
->allowField(['head_img', 'phone', 'remark', 'update_time', 'nickname'])
|
||||
->save($post);
|
||||
} catch (\Exception $e) {
|
||||
if (App::isDebug()) {
|
||||
throw $e;
|
||||
}
|
||||
$this->error('保存失败');
|
||||
$this->error('保存失败:'. $e->getMessage());
|
||||
}
|
||||
$save ? $this->success('保存成功') : $this->error('保存失败');
|
||||
}
|
||||
@@ -110,7 +120,7 @@ class IndexBase extends AdminController
|
||||
'password' => password($post['password']),
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
if(App::isDebug()){
|
||||
if (App::isDebug()) {
|
||||
throw $e;
|
||||
}
|
||||
$this->error('保存失败');
|
||||
@@ -140,8 +150,8 @@ class IndexBase extends AdminController
|
||||
'sort' => 'desc',
|
||||
'id' => 'asc',
|
||||
])
|
||||
->where('status', 1)
|
||||
->select();
|
||||
->where('status', 1)
|
||||
->select();
|
||||
|
||||
$list_menu_pid = SystemMenu::group('pid')->column('pid');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user