fix: 修复验证过的sms不会作为最新纪录被取出的问题
This commit is contained in:
@@ -129,7 +129,6 @@ export class SmsService {
|
|||||||
phone,
|
phone,
|
||||||
type,
|
type,
|
||||||
expiredAt: MoreThan(now),
|
expiredAt: MoreThan(now),
|
||||||
usedAt: null,
|
|
||||||
},
|
},
|
||||||
order: { createdAt: 'DESC' },
|
order: { createdAt: 'DESC' },
|
||||||
});
|
});
|
||||||
@@ -141,6 +140,14 @@ export class SmsService {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查被用过没
|
||||||
|
if (record.usedAt !== null) {
|
||||||
|
throw new BusinessException({
|
||||||
|
code: ErrorCode.SMS_CODE_EXPIRED,
|
||||||
|
message: '验证码已失效,请重新获取',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 检查尝试次数
|
// 检查尝试次数
|
||||||
if (record.tryCount >= LoginSmsMaxTryCount) {
|
if (record.tryCount >= LoginSmsMaxTryCount) {
|
||||||
throw new BusinessException({
|
throw new BusinessException({
|
||||||
|
|||||||
Reference in New Issue
Block a user