自动修改

This commit is contained in:
2026-07-12 07:50:27 +08:00
parent b74e4e4fe5
commit d0f0fa09af
18 changed files with 117 additions and 66 deletions
@@ -1,8 +1,7 @@
import { BadRequestException, Injectable } from '@nestjs/common';
import { loadAppConfig } from '@dukang/shared-types';
import { SMS_CODE_TTL_SECONDS, loadAppConfig } from '@dukang/shared-types';
import { RedisService } from '../../common/redis/redis.service';
const CODE_TTL_SECONDS = 300;
const RATE_TTL_SECONDS = 60;
function codeKey(phone: string, scene: string) {
@@ -36,7 +35,7 @@ export class SmsCodeStore {
async generateAndStore(phone: string, scene: string): Promise<string> {
const code = this.config.mockSms ? this.config.mockSmsCode : randomSixDigitCode();
await this.redis.client.set(codeKey(phone, scene), code, 'EX', CODE_TTL_SECONDS);
await this.redis.client.set(codeKey(phone, scene), code, 'EX', SMS_CODE_TTL_SECONDS);
return code;
}