This commit is contained in:
2026-04-22 22:01:07 +08:00
parent d8716d70b0
commit b317c2a8ea
37 changed files with 1821 additions and 515 deletions

View File

@@ -19,6 +19,10 @@ export type SendLoginCodeResult = {
cooldownSeconds: number;
expiresInSeconds: number;
providerRequestId: string | null;
providerBizId: string | null;
providerOutId: string | null;
provider: 'aliyun' | 'mock';
deliveryStatus: 'pending' | 'delivered';
};
export type SmsVerificationService = {
@@ -131,6 +135,10 @@ class AliyunSmsVerificationService implements SmsVerificationService {
cooldownSeconds: this.config.intervalSeconds,
expiresInSeconds: this.config.validTimeSeconds,
providerRequestId: body.requestId ?? body.model?.requestId ?? null,
providerBizId: body.model?.bizId ?? null,
providerOutId: body.model?.outId ?? null,
provider: 'aliyun',
deliveryStatus: 'pending',
} satisfies SendLoginCodeResult;
} catch (error) {
if (error instanceof Error && error.name === 'HttpError') {
@@ -240,6 +248,10 @@ class MockSmsVerificationService implements SmsVerificationService {
cooldownSeconds: this.config.intervalSeconds,
expiresInSeconds: this.config.validTimeSeconds,
providerRequestId: 'mock-request-id',
providerBizId: null,
providerOutId: 'mock-out-id',
provider: 'mock',
deliveryStatus: 'delivered',
} satisfies SendLoginCodeResult;
}