更新修复bug

This commit is contained in:
yaooo 2023-12-02 14:51:02 +08:00
parent fe1ea2b329
commit 421235161f
1 changed files with 4 additions and 4 deletions

View File

@ -68,7 +68,7 @@ class AdminLogic extends BaseLogic
$user = User::create([
'sn' => $userSn,
'avatar' => env('project.project_url').'/'.$avatar,
'nickname' => '用户' . $userSn,
'nickname' => $params['name'],
'account' => $params['account'],
'mobile' => $params['account'],
'is_disable' => $params['disable'],
@ -120,6 +120,7 @@ class AdminLogic extends BaseLogic
// 头像
$data['avatar'] = !empty($params['avatar']) ? FileService::setFileUrl($params['avatar']) : '';
User::where('account', $params['account'])->update([
'nickname' => $params['name'],
'is_disable' => $params['disable']
]);
// 密码
@ -184,9 +185,7 @@ class AdminLogic extends BaseLogic
if ($admin->root == YesNoEnum::YES) {
throw new \Exception("超级管理员不允许被删除");
}
if (!$admin->isEmpty()) {
echo 123;
Admin::where('id', $params['id'])->delete();
User::where('account', $admin['account'])->delete();
}
@ -289,7 +288,8 @@ class AdminLogic extends BaseLogic
$admin = Admin::findOrEmpty($params['admin_id']);
if (!$admin->isEmpty()) {
User::where('account', $admin['account'])->update([
'password' => $data['password']
'password' => $data['password'],
'nickname' => $params['name']
]);
}
}