From d5e1543e601f7248d437c0665d92d981e5237fd8 Mon Sep 17 00:00:00 2001 From: que01 Date: Wed, 23 Sep 2026 02:23:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=8C=E6=88=90=E5=93=81=E7=89=8C?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=B8=8E=E4=BF=A1=E4=BB=BB=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E9=9A=94=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/src/main.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/api/src/main.ts b/apps/api/src/main.ts index 4bf4c8c..ee93bca 100644 --- a/apps/api/src/main.ts +++ b/apps/api/src/main.ts @@ -728,7 +728,7 @@ export class AdminConfigController { const nextConfig = config ? { ...currentConfig, ...config } : undefined; if (config?.visualTemplateKey && config.visualTemplateKey !== currentConfig.visualTemplateKey) { const installation = await this.prisma.brandTemplateInstallation.findFirst({ - where: { brandId: this.brandId() }, + where: { brandId: this.brandId(request) }, }); if (installation) { const history = Array.isArray(installation.previousSnapshots) @@ -749,7 +749,7 @@ export class AdminConfigController { } } return this.prisma.brandProfile.update({ - where: { id: this.brandId() }, + where: { id: this.brandId(request) }, data: { ...fields, ...(nextConfig ? { config: nextConfig as Prisma.InputJsonValue } : {}), @@ -760,7 +760,7 @@ export class AdminConfigController { getVisualTemplateHistory(@Req() request: FastifyRequest): unknown { this.requireAdmin(request); return this.prisma.brandTemplateInstallation - .findFirst({ where: { brandId: this.brandId() }, select: { previousSnapshots: true } }) + .findFirst({ where: { brandId: this.brandId(request) }, select: { previousSnapshots: true } }) .then((installation) => ({ history: Array.isArray(installation?.previousSnapshots) ? installation.previousSnapshots.filter( @@ -776,7 +776,7 @@ export class AdminConfigController { @Post("visual-template/rollback") async rollbackVisualTemplate(@Req() request: FastifyRequest): Promise { this.requireAdmin(request); - const brandId = this.brandId(); + const brandId = this.brandId(request); const [brand, installation] = await Promise.all([ this.prisma.brandProfile.findUnique({ where: { id: brandId }, select: { config: true } }), this.prisma.brandTemplateInstallation.findFirst({ where: { brandId } }), @@ -824,7 +824,7 @@ export class AdminConfigController { getVisualTemplatePreview(@Req() request: FastifyRequest): unknown { this.requireAdmin(request); return this.prisma.brandProfile - .findUnique({ where: { id: this.brandId() }, select: { config: true } }) + .findUnique({ where: { id: this.brandId(request) }, select: { config: true } }) .then((brand) => { const config = brand?.config && typeof brand.config === "object" && !Array.isArray(brand.config) @@ -853,7 +853,7 @@ export class AdminConfigController { listTrustContent(@Req() request: FastifyRequest): Promise { this.requireAdmin(request); return this.prisma.trustContent.findMany({ - where: { brandId: this.brandId() }, + where: { brandId: this.brandId(request) }, orderBy: [{ type: "asc" }, { sortOrder: "asc" }], }); } @@ -867,7 +867,7 @@ export class AdminConfigController { return this.prisma.trustContent.create({ data: { ...fields, - brandId: this.brandId(), + brandId: this.brandId(request), ...(config === undefined ? {} : { config: config as Prisma.InputJsonValue }), }, }); @@ -880,7 +880,7 @@ export class AdminConfigController { ): Promise { this.requireAdmin(request); const item = await this.prisma.trustContent.findFirst({ - where: { id, brandId: this.brandId() }, + where: { id, brandId: this.brandId(request) }, }); if (!item) throw new BadRequestException("信任内容不存在"); const { config, ...fields } = body; @@ -899,7 +899,7 @@ export class AdminConfigController { ): Promise { this.requireAdmin(request); const item = await this.prisma.trustContent.findFirst({ - where: { id, brandId: this.brandId() }, + where: { id, brandId: this.brandId(request) }, }); if (!item) throw new BadRequestException("信任内容不存在"); await this.prisma.trustContent.delete({ where: { id } });