手机号核销确认
This commit is contained in:
@@ -87,6 +87,9 @@ export class AuthService {
|
||||
return ClientApp.PARTNER_H5;
|
||||
case SmsScene.HQ_LOGIN:
|
||||
return ClientApp.HQ_WEB;
|
||||
case SmsScene.REDEEM_PHONE_LOOKUP:
|
||||
case SmsScene.REDEEM_PHONE_CONFIRM:
|
||||
return ClientApp.SHOP_H5;
|
||||
default:
|
||||
return ClientApp.USER_H5;
|
||||
}
|
||||
@@ -129,6 +132,14 @@ export class AuthService {
|
||||
});
|
||||
return account ? { refType: 'HQ', refId: account.id } : undefined;
|
||||
}
|
||||
case SmsScene.REDEEM_PHONE_LOOKUP:
|
||||
case SmsScene.REDEEM_PHONE_CONFIRM: {
|
||||
const user = await this.prisma.user.findFirst({
|
||||
where: { phone, mergedIntoUserId: null, status: 1 },
|
||||
select: { id: true },
|
||||
});
|
||||
return user ? { refType: 'USER', refId: user.id } : undefined;
|
||||
}
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
@@ -259,6 +270,15 @@ export class AuthService {
|
||||
if (existing) throw new BadRequestException('该手机号已被使用');
|
||||
return;
|
||||
}
|
||||
if (scene === SmsScene.REDEEM_PHONE_LOOKUP || scene === SmsScene.REDEEM_PHONE_CONFIRM) {
|
||||
const user = await this.prisma.user.findFirst({
|
||||
where: { phone, mergedIntoUserId: null, status: 1 },
|
||||
select: { id: true, phoneVerifiedAt: true },
|
||||
});
|
||||
if (!user) throw new BadRequestException('该手机号未注册好客用户');
|
||||
if (!user.phoneVerifiedAt) throw new BadRequestException('用户手机号未验证,无法核销');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
async verifySmsCode(phone: string, code: string, scene: SmsScene) {
|
||||
|
||||
Reference in New Issue
Block a user