校验并修改用户手机号

This commit is contained in:
2025-09-11 16:23:07 +08:00
parent 1fb6d6ee65
commit c430ed407b
5 changed files with 308 additions and 100 deletions

View File

@@ -20,6 +20,8 @@ export interface LoginResponse {
message: string;
token?: string;
user_info?: WechatUserInfo;
phone_update_status?: string;
existing_phone?: string;
}
// 发送短信响应接口
@@ -134,6 +136,11 @@ export interface PhoneLoginParams {
user_code: string;
}
// 更新手机号接口参数
export interface ChangePhoneParams {
phone: string;
}
// 手机号验证码登录
export const phone_auth_login = async (
params: PhoneLoginParams,
@@ -159,6 +166,8 @@ export const phone_auth_login = async (
message: "登录成功",
token: verify_response.data?.token,
user_info: verify_response.data?.userInfo,
phone_update_status: verify_response.data?.phone_update_status,
existing_phone: verify_response.data?.existing_phone,
};
} else {
return {
@@ -391,3 +400,14 @@ export const updateUserProfile = async (payload: Partial<UserInfoType>) => {
throw error;
}
};
// 更新用户手机号
export const updateUserPhone = async (payload: ChangePhoneParams) => {
try {
const response = await httpService.post("/user/update_phone", payload);
return response;
} catch (error) {
console.error("更新用户手机号失败:", error);
throw error;
}
};