fix(identity-service): 修复 TypeScript 编译错误

- 修复 account.id -> account.userId 属性访问错误
- 修复 smsService.verifySmsCode 方法调用,改为直接从 Redis 验证

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-19 03:20:37 -08:00
parent 5b2d255506
commit 2662409d80
1 changed files with 8 additions and 8 deletions

View File

@ -483,7 +483,7 @@ export class UserApplicationService {
// 发布用户资料更新事件
const event = new UserProfileUpdatedEvent({
userId: account.id.value.toString(),
userId: account.userId.toString(),
accountSequence: account.accountSequence.value,
nickname: account.nickname,
avatarUrl: account.avatarUrl,
@ -1296,17 +1296,17 @@ export class UserApplicationService {
const phoneNumber = PhoneNumber.create(command.phoneNumber);
// 验证验证码
const isValid = await this.smsService.verifySmsCode(
phoneNumber.value,
command.smsCode,
command.type,
);
// 从 Redis 获取验证码进行验证
const cacheKey = `sms:${command.type.toLowerCase()}:${phoneNumber.value}`;
const cachedCode = await this.redisService.get(cacheKey);
if (!isValid) {
if (!cachedCode || cachedCode !== command.smsCode) {
throw new ApplicationError('验证码错误或已过期');
}
// 验证成功后删除验证码
await this.redisService.delete(cacheKey);
this.logger.log(`SMS code verified successfully for phone: ${this.maskPhoneNumber(command.phoneNumber)}`);
}