部分前台接口

This commit is contained in:
2025-05-07 16:52:49 +08:00
parent 7a08ac219e
commit 8a99bcb904
8 changed files with 65 additions and 5 deletions

View File

@@ -28,11 +28,16 @@ class UserController extends BaseController
*/
public function changePassword(): JsonResponse
{
$this->insertField = ['password', 'new_password'];
$this->insertField = ['old_password', 'new_password', 'confirm_password'];
$params = $this->checkRequiredFields(request()->post());
if ($params['old_password'] === $params['new_password']) {
return jerr('新密码不能与旧密码相同');
} elseif ($params['new_password'] !== $params['confirm_password']) {
return jerr('新密码与确认密码不一致');
}
return jok(
$this->service->changePassword($params['password'], $params['new_password']),
$this->service->changePassword($params['old_password'], $params['new_password']),
'重置密码成功'
);
}