From 40b8cd6431605f05c969ef85cb8f2d97a265ee18 Mon Sep 17 00:00:00 2001 From: que01 Date: Wed, 23 Sep 2026 08:56:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=81=BF=E5=85=8D=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=B7=A5=E4=BD=9C=E7=A9=BA=E9=97=B4=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E6=B1=A1=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/src/main.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/api/src/main.ts b/apps/api/src/main.ts index 3fcaa74..93d8fba 100644 --- a/apps/api/src/main.ts +++ b/apps/api/src/main.ts @@ -160,7 +160,7 @@ export class PublicWorkspaceController { : null; if (brandSlug && !selected) throw new NotFoundException("品牌不存在"); const brandId = selected?.id ?? configuredId; - const cached = this.cache.get(brandId); + const cached = process.env.NODE_ENV === "test" ? undefined : this.cache.get(brandId); if (cached && cached.expiresAt > Date.now()) return cached.value; const [ brand, @@ -343,7 +343,8 @@ export class PublicWorkspaceController { trustContent: trustContents, inquiryForm, }; - this.cache.set(brandId, { expiresAt: Date.now() + 30_000, value: response }); + if (process.env.NODE_ENV !== "test") + this.cache.set(brandId, { expiresAt: Date.now() + 30_000, value: response }); return response; } private jsonObject(value: unknown): Record {