fix: 修复头像上传

This commit is contained in:
Ying
2023-06-25 17:18:24 +08:00
parent 34dd0a2086
commit 9d9d0ca7df

View File

@@ -587,9 +587,10 @@ class User extends HomeController
if (!$response) { if (!$response) {
return $this->error(Upload::instance()->getError()); return $this->error(Upload::instance()->getError());
} }
$userInfo = $request->userInfo;
$userInfo->avatar = $response['url'] . '?' . Random::alpha(12); $avatar = $response['url'] . '?' . Random::alpha(12);
if ($userInfo->save()) { $result = $this->model->where('id', $request->userId)->update(['avatar' => $avatar]);
if (!empty($result)) {
return json($response); return json($response);
} }
} }