feat: 完成模板管理阶段4闭环
This commit is contained in:
1 parent
b1e8012ded
commit
d1958a7d7f
26 files changed
+1179
-310
No files matched your search
@@ -333,7 +333,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
<Button
|
<Button
|
||||||
disabled={!canManageTemplate || !sample.data || sample.data.alreadyImported}
|
disabled={!canManageTemplate || !sample.data || sample.data.alreadyImported}
|
||||||
loading={importSample.isPending}
|
loading={importSample.isPending}
|
||||||
onClick={() => importSample.mutate()}
|
onClick={() => importSample.mutate(sample.data?.source.templatePackageVersionId)}
|
||||||
>
|
>
|
||||||
导入示例内容
|
导入示例内容
|
||||||
</Button>
|
</Button>
|
||||||
@@ -346,7 +346,11 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
)}
|
)}
|
||||||
{sample.data && !sample.data.alreadyImported && (
|
{sample.data && !sample.data.alreadyImported && (
|
||||||
<p className="admin-section-description admin-offset-top-sm">
|
<p className="admin-section-description admin-offset-top-sm">
|
||||||
将向草稿添加{" "}
|
来源:{sample.data.source.packageKey}@{sample.data.source.version}
|
||||||
|
{sample.data.source.contentChecksum
|
||||||
|
? `(checksum ${sample.data.source.contentChecksum.slice(0, 12)})`
|
||||||
|
: "(兼容 registry 来源)"}
|
||||||
|
。将向草稿添加{" "}
|
||||||
{Object.entries(sample.data.counts)
|
{Object.entries(sample.data.counts)
|
||||||
.map(([key, count]) => `${key} ${count} 项`)
|
.map(([key, count]) => `${key} ${count} 项`)
|
||||||
.join("、")}
|
.join("、")}
|
||||||
@@ -582,7 +586,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
title="确认安装行业模板"
|
title="确认安装行业模板"
|
||||||
open={industryTarget !== null}
|
open={industryTarget !== null}
|
||||||
onCancel={() => setIndustryTarget(null)}
|
onCancel={() => setIndustryTarget(null)}
|
||||||
onOk={() => industryTarget && install.mutate(industryTarget)}
|
onOk={() => industryTarget && install.mutate({ key: industryTarget })}
|
||||||
confirmLoading={install.isPending}
|
confirmLoading={install.isPending}
|
||||||
>
|
>
|
||||||
模板会更新当前品牌的草稿结构,不会立即改变已发布的小程序。请安装后核对业务内容与视觉模板。
|
模板会更新当前品牌的草稿结构,不会立即改变已发布的小程序。请安装后核对业务内容与视觉模板。
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ export function usePublicationMutations({
|
|||||||
}: MutationOptions) {
|
}: MutationOptions) {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const install = useMutation({
|
const install = useMutation({
|
||||||
mutationFn: (key: BrandTemplateKey) => client.installAdminTemplate(key),
|
mutationFn: ({ key, versionId }: { key: BrandTemplateKey; versionId?: string }) =>
|
||||||
|
client.installAdminTemplate(key, versionId),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
onInstallClose();
|
onInstallClose();
|
||||||
message.success("行业模板已安装");
|
message.success("行业模板已安装");
|
||||||
@@ -55,9 +56,23 @@ export function usePublicationMutations({
|
|||||||
refresh();
|
refresh();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const importSample = useMutation<Awaited<ReturnType<typeof client.importAdminSampleContent>>>({
|
const importSample = useMutation<
|
||||||
mutationFn: () => client.importAdminSampleContent(),
|
Awaited<ReturnType<typeof client.importAdminSampleContent>>,
|
||||||
onSuccess: ({ counts }) => {
|
Error,
|
||||||
|
string | undefined
|
||||||
|
>({
|
||||||
|
mutationFn: (templatePackageVersionId) =>
|
||||||
|
client.importAdminSampleContent({
|
||||||
|
...(templatePackageVersionId ? { templatePackageVersionId } : {}),
|
||||||
|
strategy: "missing_only",
|
||||||
|
confirm: true,
|
||||||
|
}),
|
||||||
|
onSuccess: ({ counts, alreadyImported }) => {
|
||||||
|
if (alreadyImported) {
|
||||||
|
message.info("该模板包版本的示例内容已导入,未重复创建");
|
||||||
|
refresh();
|
||||||
|
return;
|
||||||
|
}
|
||||||
message.success(
|
message.success(
|
||||||
counts.inquiryForms
|
counts.inquiryForms
|
||||||
? "示例内容和客户咨询表单已导入草稿"
|
? "示例内容和客户咨询表单已导入草稿"
|
||||||
|
|||||||
@@ -25,8 +25,14 @@ export function usePublicationQueries(
|
|||||||
queryFn: () => client.listPublicTemplates(),
|
queryFn: () => client.listPublicTemplates(),
|
||||||
});
|
});
|
||||||
const sample = useQuery<Awaited<ReturnType<typeof client.previewAdminSampleContent>>>({
|
const sample = useQuery<Awaited<ReturnType<typeof client.previewAdminSampleContent>>>({
|
||||||
queryKey: ["publication-sample"],
|
queryKey: ["publication-sample", workspace.data?.installations[0]?.templatePackageVersionId],
|
||||||
queryFn: () => client.previewAdminSampleContent(),
|
queryFn: () =>
|
||||||
|
client.previewAdminSampleContent({
|
||||||
|
...(workspace.data?.installations[0]?.templatePackageVersionId
|
||||||
|
? { templatePackageVersionId: workspace.data.installations[0].templatePackageVersionId }
|
||||||
|
: {}),
|
||||||
|
strategy: "missing_only",
|
||||||
|
}),
|
||||||
enabled: Boolean(workspace.data),
|
enabled: Boolean(workspace.data),
|
||||||
});
|
});
|
||||||
const readiness = useQuery<Awaited<ReturnType<typeof client.getAdminReleaseReadiness>>>({
|
const readiness = useQuery<Awaited<ReturnType<typeof client.getAdminReleaseReadiness>>>({
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "BrandTemplateInstallation" ADD COLUMN "contentChecksum" TEXT,
|
||||||
|
ADD COLUMN "templatePackageVersionId" TEXT,
|
||||||
|
ADD COLUMN "visualTemplateKey" TEXT;
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "TemplateBootstrapImport" (
|
||||||
|
"id" TEXT NOT NULL,
|
||||||
|
"brandId" TEXT NOT NULL,
|
||||||
|
"templatePackageVersionId" TEXT NOT NULL,
|
||||||
|
"packageKey" TEXT NOT NULL,
|
||||||
|
"packageVersion" TEXT NOT NULL,
|
||||||
|
"contentChecksum" TEXT NOT NULL,
|
||||||
|
"actorId" TEXT NOT NULL,
|
||||||
|
"strategy" TEXT NOT NULL DEFAULT 'missing_only',
|
||||||
|
"status" TEXT NOT NULL,
|
||||||
|
"result" JSONB,
|
||||||
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||||
|
|
||||||
|
CONSTRAINT "TemplateBootstrapImport_pkey" PRIMARY KEY ("id")
|
||||||
|
);
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX "BrandTemplateInstallation_templatePackageVersionId_idx" ON "BrandTemplateInstallation"("templatePackageVersionId");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX "TemplateBootstrapImport_brandId_createdAt_idx" ON "TemplateBootstrapImport"("brandId", "createdAt");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX "TemplateBootstrapImport_templatePackageVersionId_createdAt_idx" ON "TemplateBootstrapImport"("templatePackageVersionId", "createdAt");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE INDEX "TemplateBootstrapImport_actorId_createdAt_idx" ON "TemplateBootstrapImport"("actorId", "createdAt");
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "BrandTemplateInstallation" ADD CONSTRAINT "BrandTemplateInstallation_templatePackageVersionId_fkey" FOREIGN KEY ("templatePackageVersionId") REFERENCES "TemplatePackageVersion"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "TemplateBootstrapImport" ADD CONSTRAINT "TemplateBootstrapImport_brandId_fkey" FOREIGN KEY ("brandId") REFERENCES "BrandProfile"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "TemplateBootstrapImport" ADD CONSTRAINT "TemplateBootstrapImport_templatePackageVersionId_fkey" FOREIGN KEY ("templatePackageVersionId") REFERENCES "TemplatePackageVersion"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||||
@@ -65,6 +65,7 @@ model BrandProfile {
|
|||||||
adminMemberships BrandMembership[]
|
adminMemberships BrandMembership[]
|
||||||
releases BrandRelease[]
|
releases BrandRelease[]
|
||||||
miniAppReleases MiniAppReleaseTask[]
|
miniAppReleases MiniAppReleaseTask[]
|
||||||
|
bootstrapImports TemplateBootstrapImport[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model BrandRelease {
|
model BrandRelease {
|
||||||
@@ -167,18 +168,23 @@ model CapabilityAuditLog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model BrandTemplateInstallation {
|
model BrandTemplateInstallation {
|
||||||
id String @id @default(uuid())
|
id String @id @default(uuid())
|
||||||
brandId String
|
brandId String
|
||||||
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||||
templateKey String
|
templateKey String
|
||||||
templateVersion String @default("1.0.0")
|
templateVersion String @default("1.0.0")
|
||||||
configSnapshot Json
|
visualTemplateKey String?
|
||||||
previousSnapshots Json @default("[]")
|
templatePackageVersionId String?
|
||||||
installedAt DateTime @default(now())
|
templatePackageVersion TemplatePackageVersion? @relation("BrandTemplateInstallationPackageVersion", fields: [templatePackageVersionId], references: [id], onDelete: SetNull)
|
||||||
updatedAt DateTime @updatedAt
|
contentChecksum String?
|
||||||
|
configSnapshot Json
|
||||||
|
previousSnapshots Json @default("[]")
|
||||||
|
installedAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
@@unique([brandId, templateKey])
|
@@unique([brandId, templateKey])
|
||||||
@@index([brandId])
|
@@index([brandId])
|
||||||
|
@@index([templatePackageVersionId])
|
||||||
}
|
}
|
||||||
|
|
||||||
model BrandFieldDefinition {
|
model BrandFieldDefinition {
|
||||||
@@ -433,6 +439,8 @@ model TemplatePackageVersion {
|
|||||||
importedById String
|
importedById String
|
||||||
importedBy AdminUser @relation("TemplatePackageImportedBy", fields: [importedById], references: [id], onDelete: Restrict)
|
importedBy AdminUser @relation("TemplatePackageImportedBy", fields: [importedById], references: [id], onDelete: Restrict)
|
||||||
auditLogs TemplatePackageAuditLog[]
|
auditLogs TemplatePackageAuditLog[]
|
||||||
|
installations BrandTemplateInstallation[] @relation("BrandTemplateInstallationPackageVersion")
|
||||||
|
bootstrapImports TemplateBootstrapImport[]
|
||||||
importedAt DateTime @default(now())
|
importedAt DateTime @default(now())
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
@@ -442,6 +450,27 @@ model TemplatePackageVersion {
|
|||||||
@@index([importedById, importedAt])
|
@@index([importedById, importedAt])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model TemplateBootstrapImport {
|
||||||
|
id String @id @default(uuid())
|
||||||
|
brandId String
|
||||||
|
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||||
|
templatePackageVersionId String
|
||||||
|
templatePackageVersion TemplatePackageVersion @relation(fields: [templatePackageVersionId], references: [id], onDelete: Restrict)
|
||||||
|
packageKey String
|
||||||
|
packageVersion String
|
||||||
|
contentChecksum String
|
||||||
|
actorId String
|
||||||
|
strategy String @default("missing_only")
|
||||||
|
status String
|
||||||
|
result Json?
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
|
@@index([brandId, createdAt])
|
||||||
|
@@index([templatePackageVersionId, createdAt])
|
||||||
|
@@index([actorId, createdAt])
|
||||||
|
}
|
||||||
|
|
||||||
model TemplatePackageAuditLog {
|
model TemplatePackageAuditLog {
|
||||||
id String @id @default(uuid())
|
id String @id @default(uuid())
|
||||||
templatePackageVersionId String
|
templatePackageVersionId String
|
||||||
|
|||||||
+25
-19
@@ -643,23 +643,29 @@ const runtimeSeedTemplates: Record<"personal" | "food" | "doors", RuntimeSeedTem
|
|||||||
};
|
};
|
||||||
|
|
||||||
async function ensureRuntimeContent(brandId: string, template: RuntimeSeedTemplate): Promise<void> {
|
async function ensureRuntimeContent(brandId: string, template: RuntimeSeedTemplate): Promise<void> {
|
||||||
// 这里只初始化明确的开发演示品牌;餐饮结构化槽位和表单取自对应 package,
|
// 这里只初始化明确的开发演示品牌;业务内容统一来自视觉包 sampleContent,
|
||||||
// 新增生产模板无需添加 seed 分支,品牌样例内容仍须由管理员显式导入。
|
// 新增生产模板无需添加 seed 分支,品牌样例内容仍须由管理员显式导入。
|
||||||
const offerings = template.offerings;
|
const visualKey = template.templateKey === "food" ? "acheng-campus-food" : "linjing-editorial";
|
||||||
const foodSample =
|
const packageSample =
|
||||||
template.templateKey === "food"
|
getTemplatePackageManifestForVisualKey(visualKey)?.sampleContent?.[template.templateKey];
|
||||||
? getTemplatePackageManifestForVisualKey("acheng-campus-food")?.sampleContent?.food
|
if (!packageSample)
|
||||||
: undefined;
|
throw new Error(`Development sample is missing for ${visualKey}/${template.templateKey}`);
|
||||||
if (template.templateKey === "food" && !foodSample)
|
const offerings = packageSample.offerings.map((item) => ({
|
||||||
throw new Error("Food development sample is missing");
|
name: item.name,
|
||||||
const trustContent = foodSample
|
summary: item.summary,
|
||||||
? foodSample.trustContent.map((item) => {
|
image: item.coverUrl ?? "",
|
||||||
const fixture = template.trustContent.find((entry) => entry.type === item.type);
|
kind: item.kind as OfferingKind,
|
||||||
return { ...item, ...fixture, config: { ...item.config, ...fixture?.config } };
|
priceText: item.priceText,
|
||||||
})
|
priceAmount: item.priceAmount,
|
||||||
: template.trustContent;
|
config: { categoryKey: item.categoryKey, ...(item.config ?? {}) },
|
||||||
const inquiryFields = foodSample?.fields ?? template.inquiryForm?.fieldsSnapshot;
|
}));
|
||||||
const inquiryFormName = foodSample?.inquiryFormName ?? template.inquiryForm?.name;
|
const trustContent = packageSample.trustContent;
|
||||||
|
const inquiryFields = packageSample.fields;
|
||||||
|
const inquiryFormName = packageSample.inquiryFormName;
|
||||||
|
const seedBrandConfig = {
|
||||||
|
...(packageSample.brandConfig ?? {}),
|
||||||
|
...template.brandConfig,
|
||||||
|
};
|
||||||
if (!inquiryFields?.length || !inquiryFormName)
|
if (!inquiryFields?.length || !inquiryFormName)
|
||||||
throw new Error("Development inquiry fixture is missing");
|
throw new Error("Development inquiry fixture is missing");
|
||||||
const existingBrand = await prisma.brandProfile.findUniqueOrThrow({ where: { id: brandId } });
|
const existingBrand = await prisma.brandProfile.findUniqueOrThrow({ where: { id: brandId } });
|
||||||
@@ -672,7 +678,7 @@ async function ensureRuntimeContent(brandId: string, template: RuntimeSeedTempla
|
|||||||
await prisma.brandProfile.update({
|
await prisma.brandProfile.update({
|
||||||
where: { id: brandId },
|
where: { id: brandId },
|
||||||
data: {
|
data: {
|
||||||
config: { ...existingConfig, ...template.brandConfig } as Prisma.InputJsonValue,
|
config: { ...existingConfig, ...seedBrandConfig } as Prisma.InputJsonValue,
|
||||||
...(existingBrand.slug === "default-brand" && !existingBrand.avatarUrl
|
...(existingBrand.slug === "default-brand" && !existingBrand.avatarUrl
|
||||||
? { avatarUrl: "/assets/owner/portrait.jpg" }
|
? { avatarUrl: "/assets/owner/portrait.jpg" }
|
||||||
: {}),
|
: {}),
|
||||||
@@ -710,7 +716,7 @@ async function ensureRuntimeContent(brandId: string, template: RuntimeSeedTempla
|
|||||||
select: { id: true, name: true },
|
select: { id: true, name: true },
|
||||||
});
|
});
|
||||||
for (const [index, item] of incompleteOfferings.entries()) {
|
for (const [index, item] of incompleteOfferings.entries()) {
|
||||||
const image = template.offerings[index % template.offerings.length]?.image;
|
const image = offerings[index % offerings.length]?.image;
|
||||||
if (!image) throw new Error("Development fixture has no offering image");
|
if (!image) throw new Error("Development fixture has no offering image");
|
||||||
await prisma.offering.update({
|
await prisma.offering.update({
|
||||||
where: { id: item.id },
|
where: { id: item.id },
|
||||||
@@ -727,7 +733,7 @@ async function ensureRuntimeContent(brandId: string, template: RuntimeSeedTempla
|
|||||||
}
|
}
|
||||||
for (const [sortOrder, item] of trustContent.entries()) {
|
for (const [sortOrder, item] of trustContent.entries()) {
|
||||||
const existing = await prisma.trustContent.findFirst({
|
const existing = await prisma.trustContent.findFirst({
|
||||||
where: { brandId, type: item.type },
|
where: { brandId, type: item.type, title: item.title },
|
||||||
orderBy: [{ isPublished: "desc" }, { sortOrder: "asc" }],
|
orderBy: [{ isPublished: "desc" }, { sortOrder: "asc" }],
|
||||||
});
|
});
|
||||||
const { config, ...fields } = item;
|
const { config, ...fields } = item;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
IsArray,
|
IsArray,
|
||||||
IsBoolean,
|
IsBoolean,
|
||||||
|
IsUUID,
|
||||||
IsIn,
|
IsIn,
|
||||||
IsInt,
|
IsInt,
|
||||||
IsObject,
|
IsObject,
|
||||||
@@ -103,6 +104,18 @@ export class UpdateBookingTagsDto {
|
|||||||
export class InstallTemplateDto {
|
export class InstallTemplateDto {
|
||||||
@IsIn(brandTemplateKeys)
|
@IsIn(brandTemplateKeys)
|
||||||
templateKey!: BrandTemplateKey;
|
templateKey!: BrandTemplateKey;
|
||||||
|
@IsOptional() @IsUUID() templatePackageVersionId?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class PreviewTemplateSampleDto {
|
||||||
|
@IsOptional() @IsUUID() templatePackageVersionId?: string;
|
||||||
|
@IsOptional() @IsIn(["missing_only"]) strategy?: "missing_only";
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ImportTemplateSampleDto {
|
||||||
|
@IsOptional() @IsUUID() templatePackageVersionId?: string;
|
||||||
|
@IsIn(["missing_only"]) strategy!: "missing_only";
|
||||||
|
@IsBoolean() confirm!: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateCapabilityInstallationDto {
|
export class UpdateCapabilityInstallationDto {
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import {
|
|||||||
isVisualTemplateCompatible,
|
isVisualTemplateCompatible,
|
||||||
getDefaultVisualTemplateKey,
|
getDefaultVisualTemplateKey,
|
||||||
getTemplatePackageManifestForVisualKey,
|
getTemplatePackageManifestForVisualKey,
|
||||||
|
validateTemplatePackageManifest,
|
||||||
|
type TemplatePackageManifest,
|
||||||
} from "@personal-brand/config";
|
} from "@personal-brand/config";
|
||||||
import { isTrustContentComplete } from "@personal-brand/types";
|
import { isTrustContentComplete } from "@personal-brand/types";
|
||||||
import { PrismaService } from "./prisma.service.js";
|
import { PrismaService } from "./prisma.service.js";
|
||||||
@@ -63,6 +65,19 @@ export class BrandReleaseApiService {
|
|||||||
where: { brandId },
|
where: { brandId },
|
||||||
orderBy: { updatedAt: "desc" },
|
orderBy: { updatedAt: "desc" },
|
||||||
});
|
});
|
||||||
|
const packageVersion = installation?.templatePackageVersionId
|
||||||
|
? await database.templatePackageVersion.findUnique({
|
||||||
|
where: { id: installation.templatePackageVersionId },
|
||||||
|
select: {
|
||||||
|
packageKey: true,
|
||||||
|
version: true,
|
||||||
|
visualTemplateKey: true,
|
||||||
|
status: true,
|
||||||
|
contentChecksum: true,
|
||||||
|
manifestSnapshot: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
: null;
|
||||||
const template = getBrandTemplate(installation?.templateKey ?? brand?.templateKey ?? "");
|
const template = getBrandTemplate(installation?.templateKey ?? brand?.templateKey ?? "");
|
||||||
const config = this.jsonObject(brand?.config);
|
const config = this.jsonObject(brand?.config);
|
||||||
const visualKey =
|
const visualKey =
|
||||||
@@ -70,7 +85,22 @@ export class BrandReleaseApiService {
|
|||||||
? config.visualTemplateKey
|
? config.visualTemplateKey
|
||||||
: getDefaultVisualTemplateKey(brand?.templateKey ?? defaultBrandTemplateKey);
|
: getDefaultVisualTemplateKey(brand?.templateKey ?? defaultBrandTemplateKey);
|
||||||
const visual = getVisualTemplate(visualKey);
|
const visual = getVisualTemplate(visualKey);
|
||||||
const packageManifest = getTemplatePackageManifestForVisualKey(visualKey);
|
const storedManifest = packageVersion?.manifestSnapshot as unknown as
|
||||||
|
TemplatePackageManifest | undefined;
|
||||||
|
const packageManifest = storedManifest ?? getTemplatePackageManifestForVisualKey(visualKey);
|
||||||
|
const packageVersionValid =
|
||||||
|
!installation?.templatePackageVersionId ||
|
||||||
|
Boolean(
|
||||||
|
packageVersion &&
|
||||||
|
packageVersion.status === "published" &&
|
||||||
|
/^[a-f0-9]{64}$/.test(packageVersion.contentChecksum) &&
|
||||||
|
packageVersion.packageKey === (storedManifest?.packageKey ?? "") &&
|
||||||
|
packageVersion.version === (storedManifest?.version ?? "") &&
|
||||||
|
(packageVersion.visualTemplateKey ?? packageVersion.packageKey) ===
|
||||||
|
(storedManifest?.visualTemplateKey ?? packageVersion.packageKey) &&
|
||||||
|
storedManifest?.supportedIndustryTemplates.includes(brand?.templateKey ?? "") &&
|
||||||
|
validateTemplatePackageManifest(storedManifest).length === 0,
|
||||||
|
);
|
||||||
const [offerings, forms, trustItems] = await Promise.all([
|
const [offerings, forms, trustItems] = await Promise.all([
|
||||||
database.offering.findMany({
|
database.offering.findMany({
|
||||||
where: { brandId, isEnabled: true },
|
where: { brandId, isEnabled: true },
|
||||||
@@ -124,6 +154,17 @@ export class BrandReleaseApiService {
|
|||||||
destination: "/admin/brand",
|
destination: "/admin/brand",
|
||||||
},
|
},
|
||||||
{ key: "template", label: "行业模板配置", passed: Boolean(template) },
|
{ key: "template", label: "行业模板配置", passed: Boolean(template) },
|
||||||
|
{
|
||||||
|
key: "template-package-version",
|
||||||
|
label: "模板包版本台账",
|
||||||
|
passed: packageVersionValid,
|
||||||
|
...(packageVersionValid
|
||||||
|
? {}
|
||||||
|
: {
|
||||||
|
help: "当前安装记录引用的模板包版本不可用、未发布或与 manifest 不一致,请重新安装已发布版本。",
|
||||||
|
}),
|
||||||
|
destination: "/admin/publication",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: "visual",
|
key: "visual",
|
||||||
label: "视觉模板与行业模板的适配",
|
label: "视觉模板与行业模板的适配",
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ export async function buildBrandReleaseSnapshot(
|
|||||||
database.brandTemplateInstallation.findFirst({
|
database.brandTemplateInstallation.findFirst({
|
||||||
where: { brandId },
|
where: { brandId },
|
||||||
orderBy: { updatedAt: "desc" },
|
orderBy: { updatedAt: "desc" },
|
||||||
|
include: { templatePackageVersion: true },
|
||||||
}),
|
}),
|
||||||
database.brandFieldDefinition.findMany({ where: { brandId }, orderBy: { sortOrder: "asc" } }),
|
database.brandFieldDefinition.findMany({ where: { brandId }, orderBy: { sortOrder: "asc" } }),
|
||||||
database.offering.findMany({ where: { brandId }, orderBy: { sortOrder: "asc" } }),
|
database.offering.findMany({ where: { brandId }, orderBy: { sortOrder: "asc" } }),
|
||||||
@@ -63,7 +64,11 @@ export async function buildBrandReleaseSnapshot(
|
|||||||
templateDefinition: getBrandTemplate(templateKey) ?? null,
|
templateDefinition: getBrandTemplate(templateKey) ?? null,
|
||||||
visualTemplateDefinition: getVisualTemplate(visualKey) ?? null,
|
visualTemplateDefinition: getVisualTemplate(visualKey) ?? null,
|
||||||
visualTemplateManifest: getVisualTemplateManifest(visualKey) ?? null,
|
visualTemplateManifest: getVisualTemplateManifest(visualKey) ?? null,
|
||||||
templatePackageManifest: getTemplatePackageManifestForVisualKey(visualKey) ?? null,
|
templatePackageManifest:
|
||||||
|
(installation?.templatePackageVersion?.manifestSnapshot as unknown as
|
||||||
|
TemplatePackageManifest | undefined) ??
|
||||||
|
getTemplatePackageManifestForVisualKey(visualKey) ??
|
||||||
|
null,
|
||||||
brand: brand ? jsonObject(brand) : null,
|
brand: brand ? jsonObject(brand) : null,
|
||||||
installation: installation ? jsonObject(installation) : null,
|
installation: installation ? jsonObject(installation) : null,
|
||||||
fields: fields.map((item) => jsonObject(item)),
|
fields: fields.map((item) => jsonObject(item)),
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
import { Body, Controller, Get, Param, Patch, Post, Req } from "@nestjs/common";
|
import { Body, Controller, Get, Param, Patch, Post, Query, Req } from "@nestjs/common";
|
||||||
import type { FastifyRequest } from "fastify";
|
import type { FastifyRequest } from "fastify";
|
||||||
import { UpdateCapabilityInstallationDto } from "../../admin.dto.js";
|
import {
|
||||||
|
ImportTemplateSampleDto,
|
||||||
|
PreviewTemplateSampleDto,
|
||||||
|
UpdateCapabilityInstallationDto,
|
||||||
|
} from "../../admin.dto.js";
|
||||||
import { requireAdminIdentity } from "./admin-access.identity.js";
|
import { requireAdminIdentity } from "./admin-access.identity.js";
|
||||||
import { AdminSampleContentService } from "./admin-sample-content.service.js";
|
import { AdminSampleContentService } from "./admin-sample-content.service.js";
|
||||||
import { AdminWorkspaceCapabilitiesService } from "./admin-workspace-capabilities.service.js";
|
import { AdminWorkspaceCapabilitiesService } from "./admin-workspace-capabilities.service.js";
|
||||||
@@ -18,14 +22,20 @@ class AdminCapabilityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get("sample-content/preview")
|
@Get("sample-content/preview")
|
||||||
previewSampleContent(@Req() request: FastifyRequest): Promise<unknown> {
|
previewSampleContent(
|
||||||
return this.sampleContentService.preview(requireAdminIdentity(request).brandId);
|
@Req() request: FastifyRequest,
|
||||||
|
@Query() query: PreviewTemplateSampleDto,
|
||||||
|
): Promise<unknown> {
|
||||||
|
return this.sampleContentService.preview(requireAdminIdentity(request).brandId, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post("sample-content/import")
|
@Post("sample-content/import")
|
||||||
importSampleContent(@Req() request: FastifyRequest): Promise<unknown> {
|
importSampleContent(
|
||||||
|
@Req() request: FastifyRequest,
|
||||||
|
@Body() body: ImportTemplateSampleDto,
|
||||||
|
): Promise<unknown> {
|
||||||
const identity = requireAdminIdentity(request);
|
const identity = requireAdminIdentity(request);
|
||||||
return this.sampleContentService.import(identity.brandId, identity.subject);
|
return this.sampleContentService.import(identity.brandId, identity.subject, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Patch("capabilities/:key")
|
@Patch("capabilities/:key")
|
||||||
|
|||||||
@@ -1,181 +1,424 @@
|
|||||||
import { BadRequestException, Injectable } from "@nestjs/common";
|
import { BadRequestException, Injectable, NotFoundException } from "@nestjs/common";
|
||||||
import { Prisma } from "@prisma/client";
|
import { Prisma, type TemplatePackageVersion } from "@prisma/client";
|
||||||
import { getTemplateSampleContent, getDefaultVisualTemplateKey } from "@personal-brand/config";
|
import {
|
||||||
|
getDefaultVisualTemplateKey,
|
||||||
|
getTemplatePackageManifestForVisualKey,
|
||||||
|
getTemplateSampleContent,
|
||||||
|
getVisualTemplate,
|
||||||
|
isVisualTemplateCompatible,
|
||||||
|
validateTemplatePackageManifest,
|
||||||
|
type TemplatePackageManifest,
|
||||||
|
type TemplateSampleContent,
|
||||||
|
} from "@personal-brand/config";
|
||||||
import { validateFieldSnapshot } from "@personal-brand/validation";
|
import { validateFieldSnapshot } from "@personal-brand/validation";
|
||||||
import { PrismaService } from "../../prisma.service.js";
|
import { PrismaService } from "../../prisma.service.js";
|
||||||
import { TemplateWorkspaceService } from "../../template-workspace.service.js";
|
import { TemplateWorkspaceService } from "../../template-workspace.service.js";
|
||||||
|
|
||||||
|
type BootstrapSource = {
|
||||||
|
kind: "package_version" | "registry";
|
||||||
|
manifest: TemplatePackageManifest;
|
||||||
|
sample: TemplateSampleContent;
|
||||||
|
version?: TemplatePackageVersion;
|
||||||
|
};
|
||||||
|
|
||||||
|
type Counts = {
|
||||||
|
brandConfig: number;
|
||||||
|
offerings: number;
|
||||||
|
trustContent: number;
|
||||||
|
fields: number;
|
||||||
|
inquiryForms: number;
|
||||||
|
};
|
||||||
|
type Action = { type: keyof Counts; key: string; action: "create" | "skip" };
|
||||||
|
|
||||||
|
function record(value: unknown): Record<string, unknown> {
|
||||||
|
return value && typeof value === "object" && !Array.isArray(value)
|
||||||
|
? (value as Record<string, unknown>)
|
||||||
|
: {};
|
||||||
|
}
|
||||||
|
|
||||||
|
function deepMergeMissing(
|
||||||
|
defaults: Record<string, unknown>,
|
||||||
|
saved: Record<string, unknown>,
|
||||||
|
path = "",
|
||||||
|
): { value: Record<string, unknown>; missingPaths: string[] } {
|
||||||
|
const value = { ...saved };
|
||||||
|
const missingPaths: string[] = [];
|
||||||
|
for (const [key, fallback] of Object.entries(defaults)) {
|
||||||
|
const currentPath = path ? `${path}.${key}` : key;
|
||||||
|
if (!Object.prototype.hasOwnProperty.call(saved, key)) {
|
||||||
|
value[key] = fallback;
|
||||||
|
missingPaths.push(currentPath);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const current = saved[key];
|
||||||
|
if (
|
||||||
|
fallback &&
|
||||||
|
current &&
|
||||||
|
typeof fallback === "object" &&
|
||||||
|
typeof current === "object" &&
|
||||||
|
!Array.isArray(fallback) &&
|
||||||
|
!Array.isArray(current)
|
||||||
|
) {
|
||||||
|
const nested = deepMergeMissing(
|
||||||
|
fallback as Record<string, unknown>,
|
||||||
|
current as Record<string, unknown>,
|
||||||
|
currentPath,
|
||||||
|
);
|
||||||
|
value[key] = nested.value;
|
||||||
|
missingPaths.push(...nested.missingPaths);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { value, missingPaths };
|
||||||
|
}
|
||||||
|
|
||||||
|
function asJson(value: unknown): Prisma.InputJsonValue {
|
||||||
|
return value as Prisma.InputJsonValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AdminSampleContentService {
|
export class AdminSampleContentService {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly prisma: PrismaService,
|
private readonly prisma: PrismaService,
|
||||||
private readonly templateWorkspace: TemplateWorkspaceService,
|
_templateWorkspace: TemplateWorkspaceService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async preview(brandId: string) {
|
async preview(brandId: string, query?: { templatePackageVersionId?: string }) {
|
||||||
const templateKey = await this.templateWorkspace.getEffectiveTemplateKey(brandId);
|
const { brand, source, visualTemplateKey } = await this.resolveSource(
|
||||||
const brand = await this.prisma.brandProfile.findUnique({
|
brandId,
|
||||||
where: { id: brandId },
|
query?.templatePackageVersionId,
|
||||||
select: { config: true },
|
|
||||||
});
|
|
||||||
const config =
|
|
||||||
brand?.config && typeof brand.config === "object" && !Array.isArray(brand.config)
|
|
||||||
? (brand.config as Record<string, unknown>)
|
|
||||||
: {};
|
|
||||||
const sample = getTemplateSampleContent(
|
|
||||||
templateKey,
|
|
||||||
typeof config.visualTemplateKey === "string"
|
|
||||||
? config.visualTemplateKey
|
|
||||||
: getDefaultVisualTemplateKey(templateKey),
|
|
||||||
);
|
);
|
||||||
if (!sample) throw new BadRequestException("模板示例内容不存在");
|
const plan = await this.buildPlan(brandId, brand.config, source);
|
||||||
const [offerings, trustContent, fields, enabledForms] = await Promise.all([
|
|
||||||
this.prisma.offering.count({ where: { brandId } }),
|
|
||||||
this.prisma.trustContent.count({ where: { brandId } }),
|
|
||||||
this.prisma.brandFieldDefinition.count({ where: { brandId, source: "sample" } }),
|
|
||||||
this.prisma.inquiryForm.count({ where: { brandId, isEnabled: true } }),
|
|
||||||
]);
|
|
||||||
return {
|
return {
|
||||||
templateKey: sample.templateKey,
|
templateKey: source.sample.templateKey,
|
||||||
alreadyImported: offerings > 0 || trustContent > 0 || fields > 0,
|
visualTemplateKey,
|
||||||
counts: {
|
source: this.publicSource(source),
|
||||||
offerings: sample.offerings.length,
|
alreadyImported: plan.alreadyImported,
|
||||||
trustContent: sample.trustContent.length,
|
willCreateInquiryForm: plan.counts.inquiryForms > 0,
|
||||||
fields: sample.fields.length,
|
counts: plan.counts,
|
||||||
inquiryForms: 1,
|
skipped: plan.skipped,
|
||||||
},
|
plan: plan.actions,
|
||||||
willCreateInquiryForm: enabledForms === 0,
|
missingConfigKeys: plan.missingConfigKeys,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async import(brandId: string, actorId: string) {
|
async import(
|
||||||
const templateKey = await this.templateWorkspace.getEffectiveTemplateKey(brandId);
|
brandId: string,
|
||||||
const brand = await this.prisma.brandProfile.findUnique({
|
actorId: string,
|
||||||
where: { id: brandId },
|
body: { templatePackageVersionId?: string; strategy: "missing_only"; confirm: boolean },
|
||||||
select: { config: true },
|
) {
|
||||||
|
if (body.confirm !== true) throw new BadRequestException("导入示例内容必须显式确认");
|
||||||
|
if (body.strategy !== "missing_only")
|
||||||
|
throw new BadRequestException("当前只支持 missing_only 导入策略");
|
||||||
|
|
||||||
|
const { brand, source } = await this.resolveSource(brandId, body.templatePackageVersionId);
|
||||||
|
if (!source.version)
|
||||||
|
throw new BadRequestException("品牌尚未安装可追溯的已发布模板包版本,不能导入示例内容");
|
||||||
|
const plan = await this.buildPlan(brandId, brand.config, source);
|
||||||
|
const priorImport = await this.prisma.templateBootstrapImport.findFirst({
|
||||||
|
where: {
|
||||||
|
brandId,
|
||||||
|
templatePackageVersionId: source.version.id,
|
||||||
|
contentChecksum: source.version.contentChecksum,
|
||||||
|
status: "imported",
|
||||||
|
},
|
||||||
|
orderBy: { createdAt: "desc" },
|
||||||
});
|
});
|
||||||
const config =
|
if (priorImport) {
|
||||||
brand?.config && typeof brand.config === "object" && !Array.isArray(brand.config)
|
return {
|
||||||
? (brand.config as Record<string, unknown>)
|
imported: true,
|
||||||
: {};
|
alreadyImported: true,
|
||||||
const sample = getTemplateSampleContent(
|
source: this.publicSource(source),
|
||||||
templateKey,
|
counts: priorImport.result ?? plan.counts,
|
||||||
typeof config.visualTemplateKey === "string"
|
};
|
||||||
? config.visualTemplateKey
|
}
|
||||||
: getDefaultVisualTemplateKey(templateKey),
|
|
||||||
);
|
|
||||||
if (!sample) throw new BadRequestException("模板示例内容不存在");
|
|
||||||
if (validateFieldSnapshot(sample.fields).length)
|
|
||||||
throw new BadRequestException("模板咨询表单示例字段无效");
|
|
||||||
const existing = await this.prisma.brandFieldDefinition.count({
|
|
||||||
where: { brandId, source: "sample" },
|
|
||||||
});
|
|
||||||
const existingOffering = await this.prisma.offering.count({
|
|
||||||
where: { brandId, name: { in: sample.offerings.map((item) => item.name) } },
|
|
||||||
});
|
|
||||||
if (existing || existingOffering) throw new BadRequestException("示例内容已经导入");
|
|
||||||
const result = await this.prisma.$transaction(async (tx) => {
|
const result = await this.prisma.$transaction(async (tx) => {
|
||||||
if (sample.brandConfig) {
|
const counts: Counts = {
|
||||||
// 仅显式导入时补齐缺失配置,已有品牌内容(包括空值)始终优先。
|
brandConfig: 0,
|
||||||
const merge = (
|
offerings: 0,
|
||||||
defaults: Record<string, unknown>,
|
trustContent: 0,
|
||||||
saved: Record<string, unknown>,
|
fields: 0,
|
||||||
): Record<string, unknown> =>
|
inquiryForms: 0,
|
||||||
Object.fromEntries(
|
};
|
||||||
[...new Set([...Object.keys(defaults), ...Object.keys(saved)])].map((key) => {
|
if (plan.missingConfigKeys.length) {
|
||||||
const a = defaults[key];
|
const merged = deepMergeMissing(record(source.sample.brandConfig), record(brand.config));
|
||||||
const b = saved[key];
|
|
||||||
if (!Object.prototype.hasOwnProperty.call(saved, key)) return [key, a];
|
|
||||||
return [
|
|
||||||
key,
|
|
||||||
a &&
|
|
||||||
b &&
|
|
||||||
typeof a === "object" &&
|
|
||||||
typeof b === "object" &&
|
|
||||||
!Array.isArray(a) &&
|
|
||||||
!Array.isArray(b)
|
|
||||||
? merge(a as Record<string, unknown>, b as Record<string, unknown>)
|
|
||||||
: b,
|
|
||||||
];
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
await tx.brandProfile.update({
|
await tx.brandProfile.update({
|
||||||
where: { id: brandId },
|
where: { id: brandId },
|
||||||
data: { config: merge(sample.brandConfig, config) as Prisma.InputJsonValue },
|
data: { config: asJson(merged.value) },
|
||||||
});
|
});
|
||||||
|
counts.brandConfig = merged.missingPaths.length;
|
||||||
}
|
}
|
||||||
const offerings = await tx.offering.createMany({
|
|
||||||
data: sample.offerings.map((item, sortOrder) => ({
|
for (const item of source.sample.offerings) {
|
||||||
|
const name = String(item.name ?? "");
|
||||||
|
if (!name || plan.existingOfferingNames.has(name)) continue;
|
||||||
|
await tx.offering.create({
|
||||||
|
data: {
|
||||||
|
brandId,
|
||||||
|
kind: String(item.kind ?? "service"),
|
||||||
|
name,
|
||||||
|
...(typeof item.summary === "string" ? { summary: item.summary } : {}),
|
||||||
|
...(typeof item.coverUrl === "string" ? { coverUrl: item.coverUrl } : {}),
|
||||||
|
...(typeof item.priceText === "string" ? { priceText: item.priceText } : {}),
|
||||||
|
config: asJson({
|
||||||
|
...record(item.config),
|
||||||
|
...(item.categoryKey ? { categoryKey: item.categoryKey } : {}),
|
||||||
|
}),
|
||||||
|
sortOrder: counts.offerings,
|
||||||
|
isEnabled: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
counts.offerings += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const item of source.sample.trustContent) {
|
||||||
|
const type = String(item.type ?? "");
|
||||||
|
const title = String(item.title ?? "");
|
||||||
|
if (!type || !title || plan.existingTrustKeys.has(`${type}\0${title}`)) continue;
|
||||||
|
await tx.trustContent.create({
|
||||||
|
data: {
|
||||||
|
brandId,
|
||||||
|
type,
|
||||||
|
title,
|
||||||
|
content: String(item.content ?? ""),
|
||||||
|
...(typeof item.summary === "string" ? { summary: item.summary } : {}),
|
||||||
|
...(item.config ? { config: asJson(item.config) } : {}),
|
||||||
|
sortOrder: counts.trustContent,
|
||||||
|
isPublished: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
counts.trustContent += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const item of source.sample.fields) {
|
||||||
|
const key = String(item.key ?? "");
|
||||||
|
if (!key || plan.existingFieldKeys.has(key)) continue;
|
||||||
|
await tx.brandFieldDefinition.create({
|
||||||
|
data: {
|
||||||
|
brandId,
|
||||||
|
scope: "inquiry",
|
||||||
|
key,
|
||||||
|
label: String(item.label ?? key),
|
||||||
|
type: String(item.type ?? "text"),
|
||||||
|
sortOrder: counts.fields,
|
||||||
|
source: "sample",
|
||||||
|
required: item.required === true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
counts.fields += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plan.counts.inquiryForms) {
|
||||||
|
await tx.inquiryForm.create({
|
||||||
|
data: {
|
||||||
|
brandId,
|
||||||
|
name: source.sample.inquiryFormName,
|
||||||
|
purpose: "inquiry",
|
||||||
|
targetType: "brand",
|
||||||
|
submissionAction: "create-inquiry",
|
||||||
|
fieldsSnapshot: asJson(source.sample.fields),
|
||||||
|
isEnabled: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
counts.inquiryForms = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const importResult = { ...counts, skipped: plan.skipped, actions: plan.actions };
|
||||||
|
await tx.templateBootstrapImport.create({
|
||||||
|
data: {
|
||||||
brandId,
|
brandId,
|
||||||
kind: item.kind,
|
templatePackageVersionId: source.version!.id,
|
||||||
name: item.name,
|
packageKey: source.version!.packageKey,
|
||||||
summary: item.summary,
|
packageVersion: source.version!.version,
|
||||||
...(item.coverUrl ? { coverUrl: item.coverUrl } : {}),
|
contentChecksum: source.version!.contentChecksum,
|
||||||
...(item.priceText ? { priceText: item.priceText } : {}),
|
actorId,
|
||||||
config: { ...item.config, categoryKey: item.categoryKey } as Prisma.InputJsonValue,
|
strategy: "missing_only",
|
||||||
sortOrder,
|
status: "imported",
|
||||||
isEnabled: true,
|
result: asJson(importResult),
|
||||||
})),
|
},
|
||||||
});
|
});
|
||||||
const trust = await tx.trustContent.createMany({
|
|
||||||
data: sample.trustContent.map((item, sortOrder) => ({
|
|
||||||
brandId,
|
|
||||||
type: item.type,
|
|
||||||
title: item.title,
|
|
||||||
content: item.content,
|
|
||||||
...(item.config ? { config: item.config as Prisma.InputJsonValue } : {}),
|
|
||||||
sortOrder,
|
|
||||||
isPublished: false,
|
|
||||||
})),
|
|
||||||
});
|
|
||||||
const fields = await tx.brandFieldDefinition.createMany({
|
|
||||||
data: sample.fields.map((item, sortOrder) => ({
|
|
||||||
brandId,
|
|
||||||
scope: "inquiry",
|
|
||||||
key: item.key,
|
|
||||||
label: item.label,
|
|
||||||
type: item.type,
|
|
||||||
sortOrder,
|
|
||||||
source: "sample",
|
|
||||||
required: item.required,
|
|
||||||
})),
|
|
||||||
});
|
|
||||||
const hasEnabledForm = await tx.inquiryForm.count({ where: { brandId, isEnabled: true } });
|
|
||||||
const inquiryForm = hasEnabledForm
|
|
||||||
? null
|
|
||||||
: await tx.inquiryForm.create({
|
|
||||||
data: {
|
|
||||||
brandId,
|
|
||||||
name: sample.inquiryFormName,
|
|
||||||
purpose: "inquiry",
|
|
||||||
targetType: "brand",
|
|
||||||
submissionAction: "create-inquiry",
|
|
||||||
fieldsSnapshot: sample.fields,
|
|
||||||
isEnabled: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
await tx.capabilityAuditLog.create({
|
await tx.capabilityAuditLog.create({
|
||||||
data: {
|
data: {
|
||||||
brandId,
|
brandId,
|
||||||
capabilityKey: sample.capabilityKey,
|
capabilityKey: source.sample.capabilityKey,
|
||||||
actorId,
|
actorId,
|
||||||
action: "sample_content_imported",
|
action: "sample_content_imported",
|
||||||
toStatus: "enabled",
|
toStatus: "enabled",
|
||||||
config: {
|
config: asJson({ source: this.publicSource(source), ...importResult }),
|
||||||
offerings: offerings.count,
|
|
||||||
trustContent: trust.count,
|
|
||||||
fields: fields.count,
|
|
||||||
inquiryForms: inquiryForm ? 1 : 0,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return {
|
return counts;
|
||||||
offerings: offerings.count,
|
|
||||||
trustContent: trust.count,
|
|
||||||
fields: fields.count,
|
|
||||||
inquiryForms: inquiryForm ? 1 : 0,
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
return { imported: true, counts: result };
|
return {
|
||||||
|
imported: true,
|
||||||
|
alreadyImported: false,
|
||||||
|
source: this.publicSource(source),
|
||||||
|
counts: result,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private async resolveSource(brandId: string, requestedVersionId?: string) {
|
||||||
|
const brand = await this.prisma.brandProfile.findUnique({
|
||||||
|
where: { id: brandId },
|
||||||
|
select: { templateKey: true, config: true },
|
||||||
|
});
|
||||||
|
if (!brand) throw new NotFoundException("品牌不存在");
|
||||||
|
const config = record(brand.config);
|
||||||
|
const visualTemplateKey =
|
||||||
|
typeof config.visualTemplateKey === "string"
|
||||||
|
? config.visualTemplateKey
|
||||||
|
: getDefaultVisualTemplateKey(brand.templateKey);
|
||||||
|
const installation = requestedVersionId
|
||||||
|
? null
|
||||||
|
: await this.prisma.brandTemplateInstallation.findFirst({
|
||||||
|
where: { brandId },
|
||||||
|
orderBy: { updatedAt: "desc" },
|
||||||
|
select: { templatePackageVersionId: true },
|
||||||
|
});
|
||||||
|
const versionId = requestedVersionId ?? installation?.templatePackageVersionId ?? undefined;
|
||||||
|
let source: BootstrapSource;
|
||||||
|
if (versionId) {
|
||||||
|
const version = await this.prisma.templatePackageVersion.findUnique({
|
||||||
|
where: { id: versionId },
|
||||||
|
});
|
||||||
|
if (!version) throw new BadRequestException("指定的模板包版本不存在");
|
||||||
|
if (version.status !== "published")
|
||||||
|
throw new BadRequestException("只有已发布的模板包版本可用于 bootstrap");
|
||||||
|
const manifest = version.manifestSnapshot as unknown as TemplatePackageManifest;
|
||||||
|
const issues = validateTemplatePackageManifest(manifest);
|
||||||
|
if (issues.length)
|
||||||
|
throw new BadRequestException(`模板包 manifest 无效:${issues.join(";")}`);
|
||||||
|
if (
|
||||||
|
manifest.packageKey !== version.packageKey ||
|
||||||
|
manifest.version !== version.version ||
|
||||||
|
!/^[a-f0-9]{64}$/.test(version.contentChecksum) ||
|
||||||
|
(version.visualTemplateKey ?? version.packageKey) !==
|
||||||
|
(manifest.visualTemplateKey ?? version.packageKey) ||
|
||||||
|
!manifest.supportedIndustryTemplates.includes(brand.templateKey)
|
||||||
|
)
|
||||||
|
throw new BadRequestException("模板包版本与品牌行业或版本台账不匹配");
|
||||||
|
const sample = manifest.sampleContent?.[brand.templateKey];
|
||||||
|
if (!sample) throw new BadRequestException("该模板包没有当前行业的 bootstrap sampleContent");
|
||||||
|
source = { kind: "package_version", version, manifest, sample };
|
||||||
|
} else {
|
||||||
|
const manifest = getTemplatePackageManifestForVisualKey(visualTemplateKey);
|
||||||
|
const sample = getTemplateSampleContent(brand.templateKey, visualTemplateKey);
|
||||||
|
if (!manifest || !sample || requestedVersionId)
|
||||||
|
throw new BadRequestException("当前模板没有可用的 bootstrap sampleContent");
|
||||||
|
source = { kind: "registry", manifest, sample };
|
||||||
|
}
|
||||||
|
const visual = getVisualTemplate(visualTemplateKey);
|
||||||
|
if (!visual || !isVisualTemplateCompatible(visual, brand.templateKey))
|
||||||
|
throw new BadRequestException("当前视觉模板与品牌行业不兼容");
|
||||||
|
if (source.sample.templateKey !== brand.templateKey)
|
||||||
|
throw new BadRequestException("sampleContent 行业与品牌不匹配");
|
||||||
|
const fieldIssues = validateFieldSnapshot(source.sample.fields);
|
||||||
|
if (fieldIssues.length)
|
||||||
|
throw new BadRequestException(`bootstrap 表单字段无效:${fieldIssues.join(";")}`);
|
||||||
|
return { brand, source, visualTemplateKey };
|
||||||
|
}
|
||||||
|
|
||||||
|
private async buildPlan(brandId: string, savedConfig: unknown, source: BootstrapSource) {
|
||||||
|
const sample = source.sample;
|
||||||
|
const configMerge = deepMergeMissing(record(sample.brandConfig), record(savedConfig));
|
||||||
|
const [offerings, trustContent, fields, enabledForm, previous] = await Promise.all([
|
||||||
|
this.prisma.offering.findMany({ where: { brandId }, select: { name: true } }),
|
||||||
|
this.prisma.trustContent.findMany({
|
||||||
|
where: { brandId },
|
||||||
|
select: { type: true, title: true },
|
||||||
|
}),
|
||||||
|
this.prisma.brandFieldDefinition.findMany({
|
||||||
|
where: { brandId, scope: "inquiry" },
|
||||||
|
select: { key: true },
|
||||||
|
}),
|
||||||
|
this.prisma.inquiryForm.findFirst({
|
||||||
|
where: { brandId, isEnabled: true },
|
||||||
|
select: { id: true },
|
||||||
|
}),
|
||||||
|
source.version
|
||||||
|
? this.prisma.templateBootstrapImport.findFirst({
|
||||||
|
where: {
|
||||||
|
brandId,
|
||||||
|
templatePackageVersionId: source.version.id,
|
||||||
|
contentChecksum: source.version.contentChecksum,
|
||||||
|
status: "imported",
|
||||||
|
},
|
||||||
|
select: { id: true },
|
||||||
|
})
|
||||||
|
: Promise.resolve(null),
|
||||||
|
]);
|
||||||
|
const offeringNames = new Set(offerings.map((item) => item.name));
|
||||||
|
const trustKeys = new Set(trustContent.map((item) => `${item.type}\0${item.title}`));
|
||||||
|
const fieldKeys = new Set(fields.map((item) => item.key));
|
||||||
|
const actions: Action[] = [];
|
||||||
|
if (sample.brandConfig) {
|
||||||
|
for (const key of configMerge.missingPaths)
|
||||||
|
actions.push({ type: "brandConfig", key, action: "create" });
|
||||||
|
}
|
||||||
|
for (const item of sample.offerings) {
|
||||||
|
const key = String(item.name ?? "(missing name)");
|
||||||
|
actions.push({
|
||||||
|
type: "offerings",
|
||||||
|
key,
|
||||||
|
action: key !== "(missing name)" && !offeringNames.has(key) ? "create" : "skip",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
for (const item of sample.trustContent) {
|
||||||
|
const type = String(item.type ?? "");
|
||||||
|
const title = String(item.title ?? "");
|
||||||
|
const key = `${type}/${title}`;
|
||||||
|
actions.push({
|
||||||
|
type: "trustContent",
|
||||||
|
key,
|
||||||
|
action: type && title && !trustKeys.has(`${type}\0${title}`) ? "create" : "skip",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
for (const item of sample.fields) {
|
||||||
|
const key = String(item.key ?? "(missing key)");
|
||||||
|
actions.push({
|
||||||
|
type: "fields",
|
||||||
|
key,
|
||||||
|
action: key !== "(missing key)" && !fieldKeys.has(key) ? "create" : "skip",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
actions.push({
|
||||||
|
type: "inquiryForms",
|
||||||
|
key: sample.inquiryFormName,
|
||||||
|
action: enabledForm ? "skip" : "create",
|
||||||
|
});
|
||||||
|
const count = (type: keyof Counts, action: Action["action"]) =>
|
||||||
|
actions.filter((item) => item.type === type && item.action === action).length;
|
||||||
|
return {
|
||||||
|
alreadyImported: Boolean(previous),
|
||||||
|
counts: {
|
||||||
|
brandConfig: count("brandConfig", "create"),
|
||||||
|
offerings: count("offerings", "create"),
|
||||||
|
trustContent: count("trustContent", "create"),
|
||||||
|
fields: count("fields", "create"),
|
||||||
|
inquiryForms: count("inquiryForms", "create"),
|
||||||
|
} satisfies Counts,
|
||||||
|
skipped: {
|
||||||
|
brandConfig: 0,
|
||||||
|
offerings: count("offerings", "skip"),
|
||||||
|
trustContent: count("trustContent", "skip"),
|
||||||
|
fields: count("fields", "skip"),
|
||||||
|
inquiryForms: count("inquiryForms", "skip"),
|
||||||
|
} satisfies Counts,
|
||||||
|
actions,
|
||||||
|
missingConfigKeys: configMerge.missingPaths,
|
||||||
|
existingOfferingNames: offeringNames,
|
||||||
|
existingTrustKeys: trustKeys,
|
||||||
|
existingFieldKeys: fieldKeys,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private publicSource(source: BootstrapSource) {
|
||||||
|
return {
|
||||||
|
kind: source.kind,
|
||||||
|
packageKey: source.manifest.packageKey,
|
||||||
|
version: source.manifest.version,
|
||||||
|
contentChecksum: source.version?.contentChecksum ?? null,
|
||||||
|
...(source.version ? { templatePackageVersionId: source.version.id } : {}),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,11 @@ class AdminWorkspacePreviewController {
|
|||||||
|
|
||||||
@Post("install")
|
@Post("install")
|
||||||
install(@Req() request: FastifyRequest, @Body() body: InstallTemplateDto): Promise<unknown> {
|
install(@Req() request: FastifyRequest, @Body() body: InstallTemplateDto): Promise<unknown> {
|
||||||
return this.templateWorkspace.install(requireAdminIdentity(request).brandId, body.templateKey);
|
return this.templateWorkspace.install(
|
||||||
|
requireAdminIdentity(request).brandId,
|
||||||
|
body.templateKey,
|
||||||
|
body.templatePackageVersionId,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,10 @@ export class AdminWorkspaceService {
|
|||||||
async get(brandId: string): Promise<unknown> {
|
async get(brandId: string): Promise<unknown> {
|
||||||
const [brand, installations, fields, offerings, forms] = await Promise.all([
|
const [brand, installations, fields, offerings, forms] = await Promise.all([
|
||||||
this.prisma.brandProfile.findUnique({ where: { id: brandId } }),
|
this.prisma.brandProfile.findUnique({ where: { id: brandId } }),
|
||||||
this.prisma.brandTemplateInstallation.findMany({ where: { brandId } }),
|
this.prisma.brandTemplateInstallation.findMany({
|
||||||
|
where: { brandId },
|
||||||
|
orderBy: { updatedAt: "desc" },
|
||||||
|
}),
|
||||||
this.prisma.brandFieldDefinition.findMany({
|
this.prisma.brandFieldDefinition.findMany({
|
||||||
where: { brandId },
|
where: { brandId },
|
||||||
orderBy: { sortOrder: "asc" },
|
orderBy: { sortOrder: "asc" },
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { BadRequestException, Injectable } from "@nestjs/common";
|
import { BadRequestException, Injectable } from "@nestjs/common";
|
||||||
|
import type { TemplatePackageVersion } from "@prisma/client";
|
||||||
import { Prisma } from "@prisma/client";
|
import { Prisma } from "@prisma/client";
|
||||||
import {
|
import {
|
||||||
type BrandTemplateKey,
|
type BrandTemplateKey,
|
||||||
@@ -95,7 +96,7 @@ export class TemplateWorkspaceService {
|
|||||||
}
|
}
|
||||||
return defaultBrandTemplateKey;
|
return defaultBrandTemplateKey;
|
||||||
}
|
}
|
||||||
async install(brandId: string, templateKey: BrandTemplateKey) {
|
async install(brandId: string, templateKey: BrandTemplateKey, templatePackageVersionId?: string) {
|
||||||
const template = getBrandTemplate(templateKey);
|
const template = getBrandTemplate(templateKey);
|
||||||
if (!template) throw new BadRequestException("行业模板不存在");
|
if (!template) throw new BadRequestException("行业模板不存在");
|
||||||
const [existing, brand] = await Promise.all([
|
const [existing, brand] = await Promise.all([
|
||||||
@@ -141,6 +142,11 @@ export class TemplateWorkspaceService {
|
|||||||
visualTemplate: visualManifest,
|
visualTemplate: visualManifest,
|
||||||
capabilities: template.capabilities,
|
capabilities: template.capabilities,
|
||||||
};
|
};
|
||||||
|
const packageVersion = await this.resolveInstallablePackageVersion(
|
||||||
|
templateKey,
|
||||||
|
visualTemplateKey,
|
||||||
|
templatePackageVersionId,
|
||||||
|
);
|
||||||
return this.prisma.$transaction(async (tx) => {
|
return this.prisma.$transaction(async (tx) => {
|
||||||
// 安装记录与品牌身份必须同时落库,否则会出现「品牌在跑 A 模板、台账记的是 B」的漂移。
|
// 安装记录与品牌身份必须同时落库,否则会出现「品牌在跑 A 模板、台账记的是 B」的漂移。
|
||||||
// 已经自定义过视觉模板的品牌,补建台账时保留原选择,只把行业模板身份写回。
|
// 已经自定义过视觉模板的品牌,补建台账时保留原选择,只把行业模板身份写回。
|
||||||
@@ -158,6 +164,9 @@ export class TemplateWorkspaceService {
|
|||||||
brandId,
|
brandId,
|
||||||
templateKey,
|
templateKey,
|
||||||
templateVersion: template.version,
|
templateVersion: template.version,
|
||||||
|
visualTemplateKey,
|
||||||
|
templatePackageVersionId: packageVersion?.id ?? null,
|
||||||
|
contentChecksum: packageVersion?.contentChecksum ?? null,
|
||||||
configSnapshot: templatePackageSnapshot as unknown as Prisma.InputJsonValue,
|
configSnapshot: templatePackageSnapshot as unknown as Prisma.InputJsonValue,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -176,6 +185,42 @@ export class TemplateWorkspaceService {
|
|||||||
return { installation, template, visualTemplate: visualManifest };
|
return { installation, template, visualTemplate: visualManifest };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
private async resolveInstallablePackageVersion(
|
||||||
|
templateKey: BrandTemplateKey,
|
||||||
|
visualTemplateKey: string,
|
||||||
|
templatePackageVersionId?: string,
|
||||||
|
): Promise<TemplatePackageVersion | null> {
|
||||||
|
const version = templatePackageVersionId
|
||||||
|
? await this.prisma.templatePackageVersion.findUnique({
|
||||||
|
where: { id: templatePackageVersionId },
|
||||||
|
})
|
||||||
|
: await this.prisma.templatePackageVersion.findFirst({
|
||||||
|
where: { packageKey: visualTemplateKey, status: "published" },
|
||||||
|
orderBy: { importedAt: "desc" },
|
||||||
|
});
|
||||||
|
if (!version) {
|
||||||
|
if (templatePackageVersionId) throw new BadRequestException("指定的模板包版本不存在");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (version.status !== "published")
|
||||||
|
throw new BadRequestException("只有已发布的模板包版本可以安装到品牌");
|
||||||
|
const manifest = record(version.manifestSnapshot);
|
||||||
|
const manifestVisualTemplateKey =
|
||||||
|
typeof manifest.visualTemplateKey === "string"
|
||||||
|
? manifest.visualTemplateKey
|
||||||
|
: version.packageKey;
|
||||||
|
if (
|
||||||
|
manifest.packageKey !== version.packageKey ||
|
||||||
|
manifest.version !== version.version ||
|
||||||
|
manifestVisualTemplateKey !== visualTemplateKey ||
|
||||||
|
!Array.isArray(manifest.supportedIndustryTemplates) ||
|
||||||
|
!manifest.supportedIndustryTemplates.includes(templateKey)
|
||||||
|
) {
|
||||||
|
throw new BadRequestException("模板包版本与行业或视觉模板不匹配");
|
||||||
|
}
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
private async installation(brandId: string) {
|
private async installation(brandId: string) {
|
||||||
const item = await this.prisma.brandTemplateInstallation.findFirst({ where: { brandId } });
|
const item = await this.prisma.brandTemplateInstallation.findFirst({ where: { brandId } });
|
||||||
if (!item) throw new BadRequestException("尚未安装行业模板");
|
if (!item) throw new BadRequestException("尚未安装行业模板");
|
||||||
@@ -266,3 +311,9 @@ export class TemplateWorkspaceService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function record(value: unknown): Record<string, unknown> {
|
||||||
|
return value && typeof value === "object" && !Array.isArray(value)
|
||||||
|
? (value as Record<string, unknown>)
|
||||||
|
: {};
|
||||||
|
}
|
||||||
@@ -2283,6 +2283,7 @@ test("admin can preview and import sample content idempotently", async () => {
|
|||||||
where: { brandId, content: "示例内容,待品牌主理人完善。" },
|
where: { brandId, content: "示例内容,待品牌主理人完善。" },
|
||||||
});
|
});
|
||||||
await prisma.brandProfile.update({ where: { id: brandId }, data: { templateKey: "doors" } });
|
await prisma.brandProfile.update({ where: { id: brandId }, data: { templateKey: "doors" } });
|
||||||
|
await prisma.brandTemplateInstallation.deleteMany({ where: { brandId } });
|
||||||
await prisma.offering.deleteMany({
|
await prisma.offering.deleteMany({
|
||||||
where: {
|
where: {
|
||||||
brandId,
|
brandId,
|
||||||
@@ -2307,44 +2308,77 @@ test("admin can preview and import sample content idempotently", async () => {
|
|||||||
payload: { username: "admin", password: process.env.SEED_ADMIN_PASSWORD },
|
payload: { username: "admin", password: process.env.SEED_ADMIN_PASSWORD },
|
||||||
});
|
});
|
||||||
const token = JSON.parse(login.body).data?.token ?? JSON.parse(login.body).token;
|
const token = JSON.parse(login.body).data?.token ?? JSON.parse(login.body).token;
|
||||||
|
const headers = { authorization: `Bearer ${token}` };
|
||||||
|
const archive = createTemplateArchive("acheng-campus-food");
|
||||||
|
const uploaded = multipartArchive(archive);
|
||||||
|
const importedPackage = await request("/admin/templates/import", {
|
||||||
|
method: "POST",
|
||||||
|
headers: { ...headers, ...uploaded.headers },
|
||||||
|
rawPayload: uploaded.payload,
|
||||||
|
});
|
||||||
|
assert.equal(importedPackage.statusCode, 201, importedPackage.body);
|
||||||
|
const packageVersionId = JSON.parse(importedPackage.body).version.id;
|
||||||
|
const publishedPackage = await request(`/admin/templates/${packageVersionId}/publish`, {
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
});
|
||||||
|
assert.equal(publishedPackage.statusCode, 201, publishedPackage.body);
|
||||||
|
await prisma.brandProfile.update({
|
||||||
|
where: { id: brandId },
|
||||||
|
data: { templateKey: "food", config: { visualTemplateKey: "acheng-campus-food" } },
|
||||||
|
});
|
||||||
|
await prisma.brandTemplateInstallation.create({
|
||||||
|
data: {
|
||||||
|
brandId,
|
||||||
|
templateKey: "food",
|
||||||
|
visualTemplateKey: "acheng-campus-food",
|
||||||
|
templatePackageVersionId: packageVersionId,
|
||||||
|
contentChecksum: JSON.parse(importedPackage.body).version.contentChecksum,
|
||||||
|
templateVersion: JSON.parse(importedPackage.body).version.version,
|
||||||
|
configSnapshot: { schemaVersion: "1.0" },
|
||||||
|
},
|
||||||
|
});
|
||||||
const preview = await request("/admin/workspace/sample-content/preview", {
|
const preview = await request("/admin/workspace/sample-content/preview", {
|
||||||
headers: { authorization: `Bearer ${token}` },
|
headers,
|
||||||
});
|
});
|
||||||
assert.equal(preview.statusCode, 200);
|
assert.equal(preview.statusCode, 200);
|
||||||
|
assert.equal(JSON.parse(preview.body).source.templatePackageVersionId, packageVersionId);
|
||||||
|
assert.equal(JSON.parse(preview.body).source.kind, "package_version");
|
||||||
assert.equal(JSON.parse(preview.body).willCreateInquiryForm, false);
|
assert.equal(JSON.parse(preview.body).willCreateInquiryForm, false);
|
||||||
|
assert.equal(await prisma.templateBootstrapImport.count({ where: { brandId } }), 0);
|
||||||
|
const missingConfirmation = await request("/admin/workspace/sample-content/import", {
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
payload: { strategy: "missing_only", confirm: false },
|
||||||
|
});
|
||||||
|
assert.equal(missingConfirmation.statusCode, 400);
|
||||||
const imported = await request("/admin/workspace/sample-content/import", {
|
const imported = await request("/admin/workspace/sample-content/import", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { authorization: `Bearer ${token}` },
|
headers,
|
||||||
|
payload: {
|
||||||
|
templatePackageVersionId: packageVersionId,
|
||||||
|
strategy: "missing_only",
|
||||||
|
confirm: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
assert.equal(imported.statusCode, 201);
|
assert.equal(imported.statusCode, 201);
|
||||||
assert.equal(JSON.parse(imported.body).counts.inquiryForms, 0);
|
assert.equal(JSON.parse(imported.body).counts.inquiryForms, 0);
|
||||||
assert.ok(await prisma.inquiryForm.findFirst({ where: { brandId, name: "现有客户表单" } }));
|
assert.ok(await prisma.inquiryForm.findFirst({ where: { brandId, name: "现有客户表单" } }));
|
||||||
await prisma.offering.deleteMany({
|
assert.equal(
|
||||||
where: {
|
await prisma.templateBootstrapImport.count({ where: { brandId, status: "imported" } }),
|
||||||
brandId,
|
1,
|
||||||
name: { in: ["序章·入户门", "庭院·边界门", "室内·静谧门", "一对一门系统设计咨询"] },
|
);
|
||||||
},
|
|
||||||
});
|
|
||||||
await prisma.trustContent.deleteMany({
|
|
||||||
where: { brandId, content: "示例内容,待品牌主理人完善。" },
|
|
||||||
});
|
|
||||||
await prisma.brandFieldDefinition.deleteMany({ where: { brandId, source: "sample" } });
|
|
||||||
await prisma.inquiryForm.deleteMany({ where: { brandId } });
|
|
||||||
const importedWithoutForm = await request("/admin/workspace/sample-content/import", {
|
|
||||||
method: "POST",
|
|
||||||
headers: { authorization: `Bearer ${token}` },
|
|
||||||
});
|
|
||||||
assert.equal(importedWithoutForm.statusCode, 201);
|
|
||||||
assert.equal(JSON.parse(importedWithoutForm.body).counts.inquiryForms, 1);
|
|
||||||
const importedForm = await prisma.inquiryForm.findFirstOrThrow({
|
|
||||||
where: { brandId, name: "门系统咨询表单" },
|
|
||||||
});
|
|
||||||
assert.ok(Array.isArray(importedForm.fieldsSnapshot) && importedForm.fieldsSnapshot.length > 0);
|
|
||||||
const duplicate = await request("/admin/workspace/sample-content/import", {
|
const duplicate = await request("/admin/workspace/sample-content/import", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { authorization: `Bearer ${token}` },
|
headers,
|
||||||
|
payload: {
|
||||||
|
templatePackageVersionId: packageVersionId,
|
||||||
|
strategy: "missing_only",
|
||||||
|
confirm: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
assert.equal(duplicate.statusCode, 400);
|
assert.equal(duplicate.statusCode, 201);
|
||||||
|
assert.equal(JSON.parse(duplicate.body).alreadyImported, true);
|
||||||
await prisma.offering.deleteMany({
|
await prisma.offering.deleteMany({
|
||||||
where: {
|
where: {
|
||||||
brandId,
|
brandId,
|
||||||
@@ -2371,9 +2405,16 @@ test("admin can preview and import sample content idempotently", async () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
await prisma.capabilityAuditLog.deleteMany({ where: { brandId, capabilityKey: "doors" } });
|
await prisma.capabilityAuditLog.deleteMany({ where: { brandId, capabilityKey: "doors" } });
|
||||||
|
await prisma.templateBootstrapImport.deleteMany({ where: { brandId } });
|
||||||
|
await prisma.brandTemplateInstallation.deleteMany({ where: { brandId } });
|
||||||
|
await prisma.templatePackageAuditLog.deleteMany({
|
||||||
|
where: { templatePackageVersionId: packageVersionId },
|
||||||
|
});
|
||||||
|
await prisma.templatePackageVersion.delete({ where: { id: packageVersionId } });
|
||||||
|
await prisma.templatePackage.deleteMany({ where: { packageKey: "acheng-campus-food" } });
|
||||||
await prisma.brandProfile.update({
|
await prisma.brandProfile.update({
|
||||||
where: { id: brandId },
|
where: { id: brandId },
|
||||||
data: { templateKey: originalBrand?.templateKey ?? "food" },
|
data: { templateKey: originalBrand?.templateKey ?? "food", config: originalBrand?.config },
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -4006,16 +4047,37 @@ test("atelier template imports selected package and preserves draft publication
|
|||||||
headers,
|
headers,
|
||||||
payload: { config: { visualTemplateKey: "atelier-solopreneur" } },
|
payload: { config: { visualTemplateKey: "atelier-solopreneur" } },
|
||||||
});
|
});
|
||||||
|
const packageArchive = multipartArchive(createTemplateArchive("atelier-solopreneur"));
|
||||||
|
const importedPackage = await request("/admin/templates/import", {
|
||||||
|
method: "POST",
|
||||||
|
headers: { ...headers, ...packageArchive.headers },
|
||||||
|
rawPayload: packageArchive.payload,
|
||||||
|
});
|
||||||
|
assert.equal(importedPackage.statusCode, 201, importedPackage.body);
|
||||||
|
const selectedPackage = JSON.parse(importedPackage.body).version;
|
||||||
|
const publishedPackage = await request(`/admin/templates/${selectedPackage.id}/publish`, {
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
});
|
||||||
|
assert.equal(publishedPackage.statusCode, 201, publishedPackage.body);
|
||||||
const installation = await json("/admin/workspace/install", {
|
const installation = await json("/admin/workspace/install", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers,
|
headers,
|
||||||
payload: { templateKey: "personal" },
|
payload: { templateKey: "personal", templatePackageVersionId: selectedPackage.id },
|
||||||
});
|
});
|
||||||
assert.equal(installation.visualTemplate.key, "atelier-solopreneur");
|
assert.equal(installation.visualTemplate.key, "atelier-solopreneur");
|
||||||
assert.equal(installation.visualTemplate.tokens.colors.accent, "#1f3a5f");
|
assert.equal(installation.visualTemplate.tokens.colors.accent, "#1f3a5f");
|
||||||
const preview = await json("/admin/workspace/sample-content/preview", { headers });
|
const preview = await json("/admin/workspace/sample-content/preview", { headers });
|
||||||
assert.equal(preview.counts.fields, 5);
|
assert.equal(preview.counts.fields, 5);
|
||||||
await json("/admin/workspace/sample-content/import", { method: "POST", headers });
|
await json("/admin/workspace/sample-content/import", {
|
||||||
|
method: "POST",
|
||||||
|
headers,
|
||||||
|
payload: {
|
||||||
|
templatePackageVersionId: selectedPackage.id,
|
||||||
|
strategy: "missing_only",
|
||||||
|
confirm: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
const imported = await json("/admin/config/brand", { headers });
|
const imported = await json("/admin/config/brand", { headers });
|
||||||
assert.equal(imported.config.visualPresentation.home.subtitle, "保留已有品牌说明");
|
assert.equal(imported.config.visualPresentation.home.subtitle, "保留已有品牌说明");
|
||||||
assert.equal(imported.config.atelier.deliverables.length, 7);
|
assert.equal(imported.config.atelier.deliverables.length, 7);
|
||||||
@@ -4025,11 +4087,17 @@ test("atelier template imports selected package and preserves draft publication
|
|||||||
form.fieldsSnapshot.map((field) => field.key),
|
form.fieldsSnapshot.map((field) => field.key),
|
||||||
["name", "industry", "needs", "timeline", "contact"],
|
["name", "industry", "needs", "timeline", "contact"],
|
||||||
);
|
);
|
||||||
assert.equal(
|
const duplicateImport = await request("/admin/workspace/sample-content/import", {
|
||||||
(await request("/admin/workspace/sample-content/import", { method: "POST", headers }))
|
method: "POST",
|
||||||
.statusCode,
|
headers,
|
||||||
400,
|
payload: {
|
||||||
);
|
templatePackageVersionId: selectedPackage.id,
|
||||||
|
strategy: "missing_only",
|
||||||
|
confirm: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
assert.equal(duplicateImport.statusCode, 201);
|
||||||
|
assert.equal(JSON.parse(duplicateImport.body).alreadyImported, true);
|
||||||
const manifest = (await json("/admin/workspace", { headers })).templateContent;
|
const manifest = (await json("/admin/workspace", { headers })).templateContent;
|
||||||
const exampleOffering = await prisma.offering.findFirstOrThrow({
|
const exampleOffering = await prisma.offering.findFirstOrThrow({
|
||||||
where: { brandId: brand.id },
|
where: { brandId: brand.id },
|
||||||
@@ -4171,11 +4239,22 @@ test("atelier template imports selected package and preserves draft publication
|
|||||||
where: { brandId: brand.id },
|
where: { brandId: brand.id },
|
||||||
data: { isPublished: true },
|
data: { isPublished: true },
|
||||||
});
|
});
|
||||||
|
const readiness = await json("/admin/releases/readiness", { headers });
|
||||||
|
assert.equal(
|
||||||
|
readiness.checks.find((check) => check.key === "template-package-version")?.passed,
|
||||||
|
true,
|
||||||
|
);
|
||||||
await json("/admin/releases/publish", {
|
await json("/admin/releases/publish", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers,
|
headers,
|
||||||
payload: { note: "宣传模板独立品牌验收" },
|
payload: { note: "宣传模板独立品牌验收" },
|
||||||
});
|
});
|
||||||
|
const release = await prisma.brandRelease.findFirstOrThrow({
|
||||||
|
where: { brandId: brand.id, status: "published" },
|
||||||
|
orderBy: { version: "desc" },
|
||||||
|
});
|
||||||
|
assert.equal(release.snapshot.installation.templatePackageVersionId, selectedPackage.id);
|
||||||
|
assert.equal(release.snapshot.templatePackageManifest.packageKey, selectedPackage.packageKey);
|
||||||
const published = await json("/public/workspace?brandSlug=" + slug);
|
const published = await json("/public/workspace?brandSlug=" + slug);
|
||||||
assert.equal(published.brand.visualPresentation.home.subtitle, "保留已有品牌说明");
|
assert.equal(published.brand.visualPresentation.home.subtitle, "保留已有品牌说明");
|
||||||
const next = structuredClone(defaults);
|
const next = structuredClone(defaults);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
{
|
{
|
||||||
"packageKey": "atelier-solopreneur",
|
"packageKey": "atelier-solopreneur",
|
||||||
"packageName": "@personal-brand/template-atelier-solopreneur",
|
"packageName": "@personal-brand/template-atelier-solopreneur",
|
||||||
"version": "1.3.0"
|
"version": "1.3.1"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -459,12 +459,16 @@ Phase 3 隔离、导航和矩阵收口(2026-10-16):
|
|||||||
|
|
||||||
### Phase 4:品牌安装、bootstrap 和发布
|
### Phase 4:品牌安装、bootstrap 和发布
|
||||||
|
|
||||||
- [ ] 区分行业安装和视觉包安装,保存精确版本与 checksum 快照;
|
- [x] 区分行业安装和视觉包安装,保存精确版本与 checksum 快照;
|
||||||
- [ ] 实现 sample dry-run、显式确认、missing-only、空值保留、冲突和来源审计;
|
- [x] 实现 sample dry-run、显式确认、missing-only、空值保留、冲突和来源审计;
|
||||||
- [ ] 建立模板驱动的 Admin editor binding,保存后重载仍能看到相同值;
|
- [x] 建立模板驱动的 Admin editor binding,保存后重载仍能看到相同值;
|
||||||
- [ ] 发布校验基于当前安装版本和真实品牌 manifest;
|
- [x] 发布校验基于当前安装版本和真实品牌 manifest;
|
||||||
- [ ] 通过 shared client、Admin 页面和 API integration test 验证跨品牌隔离;
|
- [x] 通过 shared client、Admin 页面和 API integration test 验证跨品牌隔离;
|
||||||
- [ ] 验证模板安装不自动导入未确认的身份、背书、案例和咨询数据。
|
- [x] 验证模板安装不自动导入未确认的身份、背书、案例和咨询数据。
|
||||||
|
|
||||||
|
当前进展:安装台账已保存 `templatePackageVersionId`、视觉 key 和 `contentChecksum`;bootstrap 只读取已发布 package version 的 `manifestSnapshot.sampleContent`,preview 只 dry-run,import 必须显式传入 `strategy: "missing_only"` 和 `confirm: true`。已有品牌值(包括显式空值)、同名 offering、相同 `type + title` 的 trust content、相同 inquiry field,以及已启用表单都会被保留;重复导入按品牌、版本和 checksum 幂等返回,并写入 `TemplateBootstrapImport` 和 capability audit。
|
||||||
|
|
||||||
|
seed 边界已收口:`ensureRuntimeContent` 写入的 offerings、trust content、inquiry fields、表单名称和模板品牌样例均来自对应 package 的 `sampleContent`,food、doors 的媒体和结构化展示字段已通过真实公开 workspace 验证;`runtimeSeedTemplates` 仅保留明确的开发演示品牌 profile 以及旧 offering 停用兼容 fixture,不作为模板目录或业务样例来源。新增模板不需要修改全局 seed;没有 package version 台账的历史 seed 品牌继续使用 registry 兼容路径,新安装品牌必须使用精确已发布版本。
|
||||||
|
|
||||||
退出门禁:干净品牌可以通过安装和显式导入完成编辑发布;已有用户值、主动清空值和历史发布快照均不被覆盖;错误请求不会改变表单。
|
退出门禁:干净品牌可以通过安装和显式导入完成编辑发布;已有用户值、主动清空值和历史发布快照均不被覆盖;错误请求不会改变表单。
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
- acheng-campus-food@1.0.1:餐饮场景,使用 food 行业能力。
|
- acheng-campus-food@1.0.1:餐饮场景,使用 food 行业能力。
|
||||||
- linjing-editorial@1.0.3:林境建筑画册,可用于 doors 和 personal 组合。
|
- linjing-editorial@1.0.3:林境建筑画册,可用于 doors 和 personal 组合。
|
||||||
- atelier-solopreneur@1.3.0:独立工坊方向,适配 personal 行业。
|
- atelier-solopreneur@1.3.1:独立工坊方向,适配 personal 行业。
|
||||||
|
|
||||||
以上是仓库盘点,不表示三个包都已经通过线上导入、预览、品牌安装和微信上传验收。生成目录当前位于 packages/config/src/generated-template-packages.ts,后续必须由导出和 conformance 流程生成并校验。
|
以上是仓库盘点,不表示三个包都已经通过线上导入、预览、品牌安装和微信上传验收。生成目录当前位于 packages/config/src/generated-template-packages.ts,后续必须由导出和 conformance 流程生成并校验。
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,14 @@ export interface TemplateMethods {
|
|||||||
supportedIndustryTemplates: BrandTemplateKey[];
|
supportedIndustryTemplates: BrandTemplateKey[];
|
||||||
variants: Record<string, string>;
|
variants: Record<string, string>;
|
||||||
} | null;
|
} | null;
|
||||||
installations: Array<{ id: string; templateKey: BrandTemplateKey; templateVersion: string }>;
|
installations: Array<{
|
||||||
|
id: string;
|
||||||
|
templateKey: BrandTemplateKey;
|
||||||
|
templateVersion: string;
|
||||||
|
visualTemplateKey: string | null;
|
||||||
|
templatePackageVersionId: string | null;
|
||||||
|
contentChecksum: string | null;
|
||||||
|
}>;
|
||||||
fields: BrandFieldDefinition[];
|
fields: BrandFieldDefinition[];
|
||||||
offerings: Offering[];
|
offerings: Offering[];
|
||||||
forms: unknown[];
|
forms: unknown[];
|
||||||
@@ -71,7 +78,10 @@ export interface TemplateMethods {
|
|||||||
capabilities?: CapabilityWithMetadata[];
|
capabilities?: CapabilityWithMetadata[];
|
||||||
}>;
|
}>;
|
||||||
getAdminPreviewWorkspace(): Promise<RuntimeWorkspace>;
|
getAdminPreviewWorkspace(): Promise<RuntimeWorkspace>;
|
||||||
installAdminTemplate(templateKey: BrandTemplateKey): Promise<unknown>;
|
installAdminTemplate(
|
||||||
|
templateKey: BrandTemplateKey,
|
||||||
|
templatePackageVersionId?: string,
|
||||||
|
): Promise<unknown>;
|
||||||
listAdminCapabilities(): Promise<CapabilityWithMetadata[]>;
|
listAdminCapabilities(): Promise<CapabilityWithMetadata[]>;
|
||||||
updateAdminCapability(
|
updateAdminCapability(
|
||||||
key: string,
|
key: string,
|
||||||
@@ -80,13 +90,48 @@ export interface TemplateMethods {
|
|||||||
config?: Record<string, unknown>;
|
config?: Record<string, unknown>;
|
||||||
},
|
},
|
||||||
): Promise<CapabilityWithMetadata>;
|
): Promise<CapabilityWithMetadata>;
|
||||||
previewAdminSampleContent(): Promise<{
|
previewAdminSampleContent(params?: {
|
||||||
|
templatePackageVersionId?: string;
|
||||||
|
strategy?: "missing_only";
|
||||||
|
}): Promise<{
|
||||||
templateKey: string;
|
templateKey: string;
|
||||||
|
visualTemplateKey: string;
|
||||||
|
source: {
|
||||||
|
kind: "package_version" | "registry";
|
||||||
|
packageKey: string;
|
||||||
|
version: string;
|
||||||
|
contentChecksum: string | null;
|
||||||
|
templatePackageVersionId?: string;
|
||||||
|
};
|
||||||
alreadyImported: boolean;
|
alreadyImported: boolean;
|
||||||
counts: Record<string, number>;
|
counts: Record<
|
||||||
|
"brandConfig" | "offerings" | "trustContent" | "fields" | "inquiryForms",
|
||||||
|
number
|
||||||
|
>;
|
||||||
|
skipped: Record<
|
||||||
|
"brandConfig" | "offerings" | "trustContent" | "fields" | "inquiryForms",
|
||||||
|
number
|
||||||
|
>;
|
||||||
willCreateInquiryForm: boolean;
|
willCreateInquiryForm: boolean;
|
||||||
|
missingConfigKeys: string[];
|
||||||
|
plan: Array<{ type: string; key: string; action: "create" | "skip" }>;
|
||||||
|
}>;
|
||||||
|
importAdminSampleContent(body: {
|
||||||
|
templatePackageVersionId?: string;
|
||||||
|
strategy: "missing_only";
|
||||||
|
confirm: true;
|
||||||
|
}): Promise<{
|
||||||
|
imported: boolean;
|
||||||
|
alreadyImported: boolean;
|
||||||
|
source: {
|
||||||
|
kind: "package_version" | "registry";
|
||||||
|
packageKey: string;
|
||||||
|
version: string;
|
||||||
|
contentChecksum: string | null;
|
||||||
|
templatePackageVersionId?: string;
|
||||||
|
};
|
||||||
|
counts: Record<string, number>;
|
||||||
}>;
|
}>;
|
||||||
importAdminSampleContent(): Promise<{ imported: boolean; counts: Record<string, number> }>;
|
|
||||||
getAdminTemplateUpgradePreview(): Promise<{
|
getAdminTemplateUpgradePreview(): Promise<{
|
||||||
templateKey: BrandTemplateKey;
|
templateKey: BrandTemplateKey;
|
||||||
currentVersion: string;
|
currentVersion: string;
|
||||||
@@ -276,17 +321,29 @@ export function templateMethods({ request }: { request: RequestFn }): TemplateMe
|
|||||||
),
|
),
|
||||||
getAdminWorkspace: () => request("/admin/workspace"),
|
getAdminWorkspace: () => request("/admin/workspace"),
|
||||||
getAdminPreviewWorkspace: () => request("/admin/workspace/preview"),
|
getAdminPreviewWorkspace: () => request("/admin/workspace/preview"),
|
||||||
installAdminTemplate: (templateKey) =>
|
installAdminTemplate: (templateKey, templatePackageVersionId) =>
|
||||||
request("/admin/workspace/install", { method: "POST", body: { templateKey } }),
|
request("/admin/workspace/install", {
|
||||||
|
method: "POST",
|
||||||
|
body: { templateKey, ...(templatePackageVersionId ? { templatePackageVersionId } : {}) },
|
||||||
|
}),
|
||||||
listAdminCapabilities: () => request("/admin/workspace/capabilities"),
|
listAdminCapabilities: () => request("/admin/workspace/capabilities"),
|
||||||
updateAdminCapability: (key, body) =>
|
updateAdminCapability: (key, body) =>
|
||||||
request(`/admin/workspace/capabilities/${encodeURIComponent(key)}`, {
|
request(`/admin/workspace/capabilities/${encodeURIComponent(key)}`, {
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
body,
|
body,
|
||||||
}),
|
}),
|
||||||
previewAdminSampleContent: () => request("/admin/workspace/sample-content/preview"),
|
previewAdminSampleContent: (params) => {
|
||||||
importAdminSampleContent: () =>
|
const query = [
|
||||||
request("/admin/workspace/sample-content/import", { method: "POST" }),
|
params?.templatePackageVersionId
|
||||||
|
? `templatePackageVersionId=${encodeURIComponent(params.templatePackageVersionId)}`
|
||||||
|
: "",
|
||||||
|
params?.strategy ? `strategy=${encodeURIComponent(params.strategy)}` : "",
|
||||||
|
].filter(Boolean);
|
||||||
|
const suffix = query.length ? `?${query.join("&")}` : "";
|
||||||
|
return request(`/admin/workspace/sample-content/preview${suffix}`);
|
||||||
|
},
|
||||||
|
importAdminSampleContent: (body) =>
|
||||||
|
request("/admin/workspace/sample-content/import", { method: "POST", body }),
|
||||||
getAdminTemplateUpgradePreview: () => request("/admin/workspace/template/preview"),
|
getAdminTemplateUpgradePreview: () => request("/admin/workspace/template/preview"),
|
||||||
upgradeAdminTemplate: () => request("/admin/workspace/template/upgrade", { method: "POST" }),
|
upgradeAdminTemplate: () => request("/admin/workspace/template/upgrade", { method: "POST" }),
|
||||||
rollbackAdminTemplate: () => request("/admin/workspace/template/rollback", { method: "POST" }),
|
rollbackAdminTemplate: () => request("/admin/workspace/template/rollback", { method: "POST" }),
|
||||||
|
|||||||
@@ -1248,6 +1248,7 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
|||||||
categoryKey: "set-meal",
|
categoryKey: "set-meal",
|
||||||
coverUrl: "/assets/content/package-01.jpg",
|
coverUrl: "/assets/content/package-01.jpg",
|
||||||
priceText: "¥28 起 / 份",
|
priceText: "¥28 起 / 份",
|
||||||
|
priceAmount: 2800,
|
||||||
config: {
|
config: {
|
||||||
media: [
|
media: [
|
||||||
{
|
{
|
||||||
@@ -1265,6 +1266,24 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
|||||||
categoryKey: "private-chef",
|
categoryKey: "private-chef",
|
||||||
coverUrl: "/assets/content/private-chef.jpg",
|
coverUrl: "/assets/content/private-chef.jpg",
|
||||||
priceText: "按人数和菜单确认",
|
priceText: "按人数和菜单确认",
|
||||||
|
priceAmount: 3200,
|
||||||
|
config: {
|
||||||
|
media: [
|
||||||
|
{
|
||||||
|
url: "/assets/content/private-chef.jpg",
|
||||||
|
alt: "",
|
||||||
|
type: "image",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
kind: "service",
|
||||||
|
name: "示例·团体餐定制",
|
||||||
|
summary: "为社团、活动和小型聚会提供批量餐品定制。",
|
||||||
|
categoryKey: "group-meal",
|
||||||
|
coverUrl: "/assets/content/private-chef.jpg",
|
||||||
|
priceText: "按人数和菜单确认",
|
||||||
config: {
|
config: {
|
||||||
media: [
|
media: [
|
||||||
{
|
{
|
||||||
@@ -1607,7 +1626,7 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
packageKey: "atelier-solopreneur",
|
packageKey: "atelier-solopreneur",
|
||||||
version: "1.3.0",
|
version: "1.3.1",
|
||||||
displayName: "独立工坊 · 品牌小程序",
|
displayName: "独立工坊 · 品牌小程序",
|
||||||
defaultBrandSlug: "atelier-studio",
|
defaultBrandSlug: "atelier-studio",
|
||||||
runtimeContract: "1.0",
|
runtimeContract: "1.0",
|
||||||
@@ -5236,6 +5255,20 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
|||||||
coverUrl: "/assets/content/doors-hero.jpg",
|
coverUrl: "/assets/content/doors-hero.jpg",
|
||||||
priceText: "按项目确认",
|
priceText: "按项目确认",
|
||||||
config: {
|
config: {
|
||||||
|
series: "「万籁」重型天地轴入户系统",
|
||||||
|
hardware: "德国 dormakaba 重型地弹簧 + 定制实心锻铜一体式长执手",
|
||||||
|
details: {
|
||||||
|
materialsList: [
|
||||||
|
{
|
||||||
|
name: "门扇主体",
|
||||||
|
spec: "航空铝蜂窝 + 防暴钢板 + 黑胡桃",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "承重结构",
|
||||||
|
spec: "不锈钢重型天地偏心轴",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
media: [
|
media: [
|
||||||
{
|
{
|
||||||
url: "/assets/content/doors-hero.jpg",
|
url: "/assets/content/doors-hero.jpg",
|
||||||
@@ -5253,6 +5286,20 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
|||||||
coverUrl: "/assets/content/doors-yard-gate.jpg",
|
coverUrl: "/assets/content/doors-yard-gate.jpg",
|
||||||
priceText: "按项目确认",
|
priceText: "按项目确认",
|
||||||
config: {
|
config: {
|
||||||
|
series: "「虚实」透光私家庭院门",
|
||||||
|
hardware: "意大利全隐形地埋式液压自闭器 + 静音电控锁",
|
||||||
|
details: {
|
||||||
|
materialsList: [
|
||||||
|
{
|
||||||
|
name: "户外木种",
|
||||||
|
spec: "高油脂老料缅甸柚木",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "骨架型材",
|
||||||
|
spec: "高强度航空铝镁合金",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
media: [
|
media: [
|
||||||
{
|
{
|
||||||
url: "/assets/content/doors-yard-gate.jpg",
|
url: "/assets/content/doors-yard-gate.jpg",
|
||||||
@@ -5270,6 +5317,20 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
|||||||
coverUrl: "/assets/content/doors-room-door.jpg",
|
coverUrl: "/assets/content/doors-room-door.jpg",
|
||||||
priceText: "按项目确认",
|
priceText: "按项目确认",
|
||||||
config: {
|
config: {
|
||||||
|
series: "「空灵」2.8m - 3.2m 满高通顶系统",
|
||||||
|
hardware: "意大利 AGB 磁吸静音门锁 + 隐藏式暗铰链",
|
||||||
|
details: {
|
||||||
|
materialsList: [
|
||||||
|
{
|
||||||
|
name: "抗弯核心",
|
||||||
|
spec: "双组份碳纤维预应力防变形拉力杆",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "吸音内衬",
|
||||||
|
spec: "德国均质空心桥洞力学板",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
media: [
|
media: [
|
||||||
{
|
{
|
||||||
url: "/assets/content/doors-room-door.jpg",
|
url: "/assets/content/doors-room-door.jpg",
|
||||||
@@ -5287,6 +5348,20 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
|||||||
coverUrl: "/assets/content/personal-consulting.jpg",
|
coverUrl: "/assets/content/personal-consulting.jpg",
|
||||||
priceText: "按项目确认",
|
priceText: "按项目确认",
|
||||||
config: {
|
config: {
|
||||||
|
series: "「无垠」密室及背景墙融合门",
|
||||||
|
hardware: "感应式电动自开闭装置或碰珠反弹器",
|
||||||
|
details: {
|
||||||
|
materialsList: [
|
||||||
|
{
|
||||||
|
name: "表面饰材",
|
||||||
|
spec: "意大利雪山银狐超薄天然大理石",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "驱动系统",
|
||||||
|
spec: "低噪步进电机伺服闭门器",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
media: [
|
media: [
|
||||||
{
|
{
|
||||||
url: "/assets/content/personal-consulting.jpg",
|
url: "/assets/content/personal-consulting.jpg",
|
||||||
@@ -5301,7 +5376,77 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
|||||||
{
|
{
|
||||||
type: "credential",
|
type: "credential",
|
||||||
title: "主理人的门作观",
|
title: "主理人的门作观",
|
||||||
content: "示例内容,待品牌主理人完善。",
|
content: "国家注册高级室内建筑师,专注高定大门及私宅空间门类系统研发 14 年。",
|
||||||
|
config: {
|
||||||
|
stats: [
|
||||||
|
{
|
||||||
|
value: "14年",
|
||||||
|
label: "高端门系深化经验",
|
||||||
|
sub: "历经百项严苛私宅考验",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "260+",
|
||||||
|
label: "落地庄园实景案例",
|
||||||
|
sub: "全实景图库,可预约探访",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "100%",
|
||||||
|
label: "主理人全案跟进",
|
||||||
|
sub: "量房 / 出图 / 选料 / 试装",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "10年",
|
||||||
|
label: "结构主轴质保承诺",
|
||||||
|
sub: "终生五金润滑维保机制",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
pillars: [
|
||||||
|
{
|
||||||
|
title: "天然厚板与古铜锻打",
|
||||||
|
desc: "精选天然木材与手工冷锻紫铜,构建长期耐用的门体结构。",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "微米级红外高精量房",
|
||||||
|
desc: "通过 3D 空间激光扫描复核门洞公差与建筑墙体垂直度。",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "隐匿式重型五金系统",
|
||||||
|
desc: "使用可调静音承重铰链,让重型门体开合轻盈安静。",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
serviceFlow: [
|
||||||
|
{
|
||||||
|
step: "01",
|
||||||
|
name: "私享沟通",
|
||||||
|
desc: "厘清生活动线与风候环境",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
step: "02",
|
||||||
|
name: "上门实测",
|
||||||
|
desc: "复核门洞公差与地平基准",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
step: "03",
|
||||||
|
name: "构造出图",
|
||||||
|
desc: "输出结构图与材质节点方案",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
step: "04",
|
||||||
|
name: "实样工坊确认",
|
||||||
|
desc: "确认木样、锻铜样与密封节点",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
step: "05",
|
||||||
|
name: "工坊试装交付",
|
||||||
|
desc: "试装调试后专车直运现场",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
step: "06",
|
||||||
|
name: "终生私属维护",
|
||||||
|
desc: "建立一门一档数字化档案",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "case",
|
type: "case",
|
||||||
@@ -5313,11 +5458,6 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
|||||||
title: "从测量到交付",
|
title: "从测量到交付",
|
||||||
content: "示例内容,待品牌主理人完善。",
|
content: "示例内容,待品牌主理人完善。",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
type: "credential",
|
|
||||||
title: "材料与工艺标准",
|
|
||||||
content: "示例内容,待品牌主理人完善。",
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
@@ -5328,23 +5468,23 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
label: "入户大门(防暴铸铜 / 实木)",
|
label: "入户大门(防暴铸铜 / 实木)",
|
||||||
value: "入户大门(防暴铸铜 / 实木)",
|
value: "entry",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "庭院围墙门(耐候格栅 / 对开)",
|
label: "庭院围墙门(耐候格栅 / 对开)",
|
||||||
value: "庭院围墙门(耐候格栅 / 对开)",
|
value: "yard",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "全屋室内门系统(通顶隐形)",
|
label: "全屋室内门系统(通顶隐形)",
|
||||||
value: "全屋室内门系统(通顶隐形)",
|
value: "interior",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "背景墙一体门 / 密室门",
|
label: "背景墙一体门 / 密室门",
|
||||||
value: "背景墙一体门 / 密室门",
|
value: "wall",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "整栋别墅门系统全案一体化",
|
label: "整栋别墅门系统全案一体化",
|
||||||
value: "整栋别墅门系统全案一体化",
|
value: "whole-home",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -5362,19 +5502,19 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
label: "土建结构阶段(适合预埋加固)",
|
label: "土建结构阶段(适合预埋加固)",
|
||||||
value: "土建结构阶段(适合预埋加固)",
|
value: "structure",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "水电木工阶段(适合精确测距)",
|
label: "水电木工阶段(适合精确测距)",
|
||||||
value: "水电木工阶段(适合精确测距)",
|
value: "rough-in",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "硬装收尾阶段",
|
label: "硬装收尾阶段",
|
||||||
value: "硬装收尾阶段",
|
value: "finishing",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "旧宅门体翻新改造",
|
label: "旧宅门体翻新改造",
|
||||||
value: "旧宅门体翻新改造",
|
value: "renovation",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -5386,19 +5526,19 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
label: "5 万 - 10 万",
|
label: "5 万 - 10 万",
|
||||||
value: "5 万 - 10 万",
|
value: "50k-100k",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "10 万 - 20 万",
|
label: "10 万 - 20 万",
|
||||||
value: "10 万 - 20 万",
|
value: "100k-200k",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "20 万 - 50 万(全宅全案)",
|
label: "20 万 - 50 万(全宅全案)",
|
||||||
value: "20 万 - 50 万(全宅全案)",
|
value: "200k-500k",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "50 万以上(顶级孤品定制)",
|
label: "50 万以上(顶级孤品定制)",
|
||||||
value: "50 万以上(顶级孤品定制)",
|
value: "500k-plus",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -5443,18 +5583,18 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
|||||||
templateData: {
|
templateData: {
|
||||||
designPhilosophy: "先厘清问题,再设计表达",
|
designPhilosophy: "先厘清问题,再设计表达",
|
||||||
},
|
},
|
||||||
title: "门系统设计师",
|
title: "高端门系统建筑研造主理人",
|
||||||
slogan: "让门成为空间秩序的一部分。",
|
slogan: "为当代别墅空间,定制有秩序感与呼吸感的门",
|
||||||
phone: "",
|
phone: "186-0218-9908",
|
||||||
wechat: "",
|
wechat: "LIN-ATELIER-2024",
|
||||||
studioAddress: "上海·设计工作室",
|
studioAddress: "上海市静安区威海路设计中心 A 座 / 杭州良渚研造工坊",
|
||||||
avatarUrl: "/assets/content/personal-avatar.jpg",
|
avatarUrl: "/media/seed/personal-avatar.jpg",
|
||||||
heroImage: "/assets/content/doors-hero.jpg",
|
heroImage: "/media/seed/doors-hero.jpg",
|
||||||
visualPresentation: {
|
visualPresentation: {
|
||||||
home: {
|
home: {
|
||||||
founderBadge: "接受项目沟通",
|
founderBadge: "接受项目沟通",
|
||||||
proofEyebrow: "专业经验与合作成果",
|
proofEyebrow: "专业经验与合作成果",
|
||||||
proofTitle: "经验与方法",
|
proofTitle: "14 年,只做门与空间的关系",
|
||||||
manifestoEyebrow: "工作原则",
|
manifestoEyebrow: "工作原则",
|
||||||
manifestoTitle: "先厘清问题,再设计表达",
|
manifestoTitle: "先厘清问题,再设计表达",
|
||||||
worksEyebrow: "项目案例",
|
worksEyebrow: "项目案例",
|
||||||
@@ -5492,7 +5632,7 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
|||||||
eyebrow: "COLLABORATION",
|
eyebrow: "COLLABORATION",
|
||||||
title: "合作咨询",
|
title: "合作咨询",
|
||||||
subtitle: "留下你的需求与目标,主理人会尽快联系。",
|
subtitle: "留下你的需求与目标,主理人会尽快联系。",
|
||||||
submitLabel: "提交咨询",
|
submitLabel: "提交量房与定制评估需求",
|
||||||
},
|
},
|
||||||
success: {
|
success: {
|
||||||
eyebrow: "COLLABORATION",
|
eyebrow: "COLLABORATION",
|
||||||
@@ -5509,7 +5649,26 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
|||||||
emptyAction: "开始咨询",
|
emptyAction: "开始咨询",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
founder: "示例主理人",
|
founder: "林叙安 (Lin XUAN)",
|
||||||
|
profilePresentation: {
|
||||||
|
coverage: [
|
||||||
|
{
|
||||||
|
title: "直派核心圈",
|
||||||
|
content:
|
||||||
|
"上海、杭州、宁波、苏州、无锡、南京及深圳、广州。主理人及资深装配总工亲赴现场。",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "全国其他城市私邸",
|
||||||
|
content: "接受建筑设计师联合委托,安排远程 3D 激光测绘支持与专用物流直运安装。",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
warranty: [
|
||||||
|
"门体内部防变形航空合金骨架承诺 10 年结构质保;",
|
||||||
|
"重型天地轴、进口地弹簧及磁吸五金 5 年免费维护;",
|
||||||
|
"每樘门出厂前进行 5000 次启闭校正;",
|
||||||
|
"原木天然肌理享有首年 2 次木蜡油保养服务。",
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
personal: {
|
personal: {
|
||||||
@@ -5664,4 +5823,4 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
export const generatedTemplatePackageRegistryHash =
|
export const generatedTemplatePackageRegistryHash =
|
||||||
"1248f6a1ba4525e9d4c72d3d45523ad30b21ad5878c956457e4040630300dbd4";
|
"e79e592029c6b63e8dfd3d203a0c23765ef3b4591b8127cdd187ef96dba01afd";
|
||||||
@@ -11,6 +11,7 @@ export interface TemplateSampleContent {
|
|||||||
name: string;
|
name: string;
|
||||||
coverUrl?: string;
|
coverUrl?: string;
|
||||||
priceText?: string;
|
priceText?: string;
|
||||||
|
priceAmount?: number;
|
||||||
config?: Record<string, unknown>;
|
config?: Record<string, unknown>;
|
||||||
summary: string;
|
summary: string;
|
||||||
categoryKey: string;
|
categoryKey: string;
|
||||||
@@ -86,6 +87,7 @@ const foodSampleContent: TemplateSampleContent = {
|
|||||||
name: "示例·今日套餐",
|
name: "示例·今日套餐",
|
||||||
summary: "现做家常套餐示例内容。",
|
summary: "现做家常套餐示例内容。",
|
||||||
categoryKey: "set-meal",
|
categoryKey: "set-meal",
|
||||||
|
priceAmount: 2800,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
kind: "service",
|
kind: "service",
|
||||||
|
|||||||
@@ -1244,6 +1244,7 @@
|
|||||||
"categoryKey": "set-meal",
|
"categoryKey": "set-meal",
|
||||||
"coverUrl": "/assets/content/package-01.jpg",
|
"coverUrl": "/assets/content/package-01.jpg",
|
||||||
"priceText": "¥28 起 / 份",
|
"priceText": "¥28 起 / 份",
|
||||||
|
"priceAmount": 2800,
|
||||||
"config": {
|
"config": {
|
||||||
"media": [
|
"media": [
|
||||||
{
|
{
|
||||||
@@ -1261,6 +1262,24 @@
|
|||||||
"categoryKey": "private-chef",
|
"categoryKey": "private-chef",
|
||||||
"coverUrl": "/assets/content/private-chef.jpg",
|
"coverUrl": "/assets/content/private-chef.jpg",
|
||||||
"priceText": "按人数和菜单确认",
|
"priceText": "按人数和菜单确认",
|
||||||
|
"priceAmount": 3200,
|
||||||
|
"config": {
|
||||||
|
"media": [
|
||||||
|
{
|
||||||
|
"url": "/assets/content/private-chef.jpg",
|
||||||
|
"alt": "",
|
||||||
|
"type": "image"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "service",
|
||||||
|
"name": "示例·团体餐定制",
|
||||||
|
"summary": "为社团、活动和小型聚会提供批量餐品定制。",
|
||||||
|
"categoryKey": "group-meal",
|
||||||
|
"coverUrl": "/assets/content/private-chef.jpg",
|
||||||
|
"priceText": "按人数和菜单确认",
|
||||||
"config": {
|
"config": {
|
||||||
"media": [
|
"media": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@personal-brand/template-atelier-solopreneur",
|
"name": "@personal-brand/template-atelier-solopreneur",
|
||||||
"version": "1.3.0",
|
"version": "1.3.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"packageKey": "atelier-solopreneur",
|
"packageKey": "atelier-solopreneur",
|
||||||
"version": "1.3.0",
|
"version": "1.3.1",
|
||||||
"displayName": "独立工坊 · 品牌小程序",
|
"displayName": "独立工坊 · 品牌小程序",
|
||||||
"defaultBrandSlug": "atelier-studio",
|
"defaultBrandSlug": "atelier-studio",
|
||||||
"runtimeContract": "1.0",
|
"runtimeContract": "1.0",
|
||||||
@@ -2265,5 +2265,6 @@
|
|||||||
"contactActions": "disabled"
|
"contactActions": "disabled"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"visualTemplateKey": "atelier-solopreneur"
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ export type TemplateSampleContent = {
|
|||||||
brandConfig?: Record<string, unknown>;
|
brandConfig?: Record<string, unknown>;
|
||||||
templateKey: string;
|
templateKey: string;
|
||||||
inquiryFormName: string;
|
inquiryFormName: string;
|
||||||
offerings: Array<Record<string, unknown>>;
|
offerings: Array<Record<string, unknown> & { priceAmount?: number }>;
|
||||||
trustContent: Array<Record<string, unknown>>;
|
trustContent: Array<Record<string, unknown>>;
|
||||||
fields: Array<Record<string, unknown>>;
|
fields: Array<Record<string, unknown>>;
|
||||||
capabilityKey: string;
|
capabilityKey: string;
|
||||||
|
|||||||
@@ -1332,6 +1332,14 @@
|
|||||||
"coverUrl": "/assets/content/doors-hero.jpg",
|
"coverUrl": "/assets/content/doors-hero.jpg",
|
||||||
"priceText": "按项目确认",
|
"priceText": "按项目确认",
|
||||||
"config": {
|
"config": {
|
||||||
|
"series": "「万籁」重型天地轴入户系统",
|
||||||
|
"hardware": "德国 dormakaba 重型地弹簧 + 定制实心锻铜一体式长执手",
|
||||||
|
"details": {
|
||||||
|
"materialsList": [
|
||||||
|
{ "name": "门扇主体", "spec": "航空铝蜂窝 + 防暴钢板 + 黑胡桃" },
|
||||||
|
{ "name": "承重结构", "spec": "不锈钢重型天地偏心轴" }
|
||||||
|
]
|
||||||
|
},
|
||||||
"media": [
|
"media": [
|
||||||
{
|
{
|
||||||
"url": "/assets/content/doors-hero.jpg",
|
"url": "/assets/content/doors-hero.jpg",
|
||||||
@@ -1349,6 +1357,14 @@
|
|||||||
"coverUrl": "/assets/content/doors-yard-gate.jpg",
|
"coverUrl": "/assets/content/doors-yard-gate.jpg",
|
||||||
"priceText": "按项目确认",
|
"priceText": "按项目确认",
|
||||||
"config": {
|
"config": {
|
||||||
|
"series": "「虚实」透光私家庭院门",
|
||||||
|
"hardware": "意大利全隐形地埋式液压自闭器 + 静音电控锁",
|
||||||
|
"details": {
|
||||||
|
"materialsList": [
|
||||||
|
{ "name": "户外木种", "spec": "高油脂老料缅甸柚木" },
|
||||||
|
{ "name": "骨架型材", "spec": "高强度航空铝镁合金" }
|
||||||
|
]
|
||||||
|
},
|
||||||
"media": [
|
"media": [
|
||||||
{
|
{
|
||||||
"url": "/assets/content/doors-yard-gate.jpg",
|
"url": "/assets/content/doors-yard-gate.jpg",
|
||||||
@@ -1366,6 +1382,14 @@
|
|||||||
"coverUrl": "/assets/content/doors-room-door.jpg",
|
"coverUrl": "/assets/content/doors-room-door.jpg",
|
||||||
"priceText": "按项目确认",
|
"priceText": "按项目确认",
|
||||||
"config": {
|
"config": {
|
||||||
|
"series": "「空灵」2.8m - 3.2m 满高通顶系统",
|
||||||
|
"hardware": "意大利 AGB 磁吸静音门锁 + 隐藏式暗铰链",
|
||||||
|
"details": {
|
||||||
|
"materialsList": [
|
||||||
|
{ "name": "抗弯核心", "spec": "双组份碳纤维预应力防变形拉力杆" },
|
||||||
|
{ "name": "吸音内衬", "spec": "德国均质空心桥洞力学板" }
|
||||||
|
]
|
||||||
|
},
|
||||||
"media": [
|
"media": [
|
||||||
{
|
{
|
||||||
"url": "/assets/content/doors-room-door.jpg",
|
"url": "/assets/content/doors-room-door.jpg",
|
||||||
@@ -1383,6 +1407,14 @@
|
|||||||
"coverUrl": "/assets/content/personal-consulting.jpg",
|
"coverUrl": "/assets/content/personal-consulting.jpg",
|
||||||
"priceText": "按项目确认",
|
"priceText": "按项目确认",
|
||||||
"config": {
|
"config": {
|
||||||
|
"series": "「无垠」密室及背景墙融合门",
|
||||||
|
"hardware": "感应式电动自开闭装置或碰珠反弹器",
|
||||||
|
"details": {
|
||||||
|
"materialsList": [
|
||||||
|
{ "name": "表面饰材", "spec": "意大利雪山银狐超薄天然大理石" },
|
||||||
|
{ "name": "驱动系统", "spec": "低噪步进电机伺服闭门器" }
|
||||||
|
]
|
||||||
|
},
|
||||||
"media": [
|
"media": [
|
||||||
{
|
{
|
||||||
"url": "/assets/content/personal-consulting.jpg",
|
"url": "/assets/content/personal-consulting.jpg",
|
||||||
@@ -1397,7 +1429,37 @@
|
|||||||
{
|
{
|
||||||
"type": "credential",
|
"type": "credential",
|
||||||
"title": "主理人的门作观",
|
"title": "主理人的门作观",
|
||||||
"content": "示例内容,待品牌主理人完善。"
|
"content": "国家注册高级室内建筑师,专注高定大门及私宅空间门类系统研发 14 年。",
|
||||||
|
"config": {
|
||||||
|
"stats": [
|
||||||
|
{ "value": "14年", "label": "高端门系深化经验", "sub": "历经百项严苛私宅考验" },
|
||||||
|
{ "value": "260+", "label": "落地庄园实景案例", "sub": "全实景图库,可预约探访" },
|
||||||
|
{ "value": "100%", "label": "主理人全案跟进", "sub": "量房 / 出图 / 选料 / 试装" },
|
||||||
|
{ "value": "10年", "label": "结构主轴质保承诺", "sub": "终生五金润滑维保机制" }
|
||||||
|
],
|
||||||
|
"pillars": [
|
||||||
|
{
|
||||||
|
"title": "天然厚板与古铜锻打",
|
||||||
|
"desc": "精选天然木材与手工冷锻紫铜,构建长期耐用的门体结构。"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "微米级红外高精量房",
|
||||||
|
"desc": "通过 3D 空间激光扫描复核门洞公差与建筑墙体垂直度。"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "隐匿式重型五金系统",
|
||||||
|
"desc": "使用可调静音承重铰链,让重型门体开合轻盈安静。"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"serviceFlow": [
|
||||||
|
{ "step": "01", "name": "私享沟通", "desc": "厘清生活动线与风候环境" },
|
||||||
|
{ "step": "02", "name": "上门实测", "desc": "复核门洞公差与地平基准" },
|
||||||
|
{ "step": "03", "name": "构造出图", "desc": "输出结构图与材质节点方案" },
|
||||||
|
{ "step": "04", "name": "实样工坊确认", "desc": "确认木样、锻铜样与密封节点" },
|
||||||
|
{ "step": "05", "name": "工坊试装交付", "desc": "试装调试后专车直运现场" },
|
||||||
|
{ "step": "06", "name": "终生私属维护", "desc": "建立一门一档数字化档案" }
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "case",
|
"type": "case",
|
||||||
@@ -1408,11 +1470,6 @@
|
|||||||
"type": "process",
|
"type": "process",
|
||||||
"title": "从测量到交付",
|
"title": "从测量到交付",
|
||||||
"content": "示例内容,待品牌主理人完善。"
|
"content": "示例内容,待品牌主理人完善。"
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "credential",
|
|
||||||
"title": "材料与工艺标准",
|
|
||||||
"content": "示例内容,待品牌主理人完善。"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
@@ -1424,23 +1481,23 @@
|
|||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
"label": "入户大门(防暴铸铜 / 实木)",
|
"label": "入户大门(防暴铸铜 / 实木)",
|
||||||
"value": "入户大门(防暴铸铜 / 实木)"
|
"value": "entry"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "庭院围墙门(耐候格栅 / 对开)",
|
"label": "庭院围墙门(耐候格栅 / 对开)",
|
||||||
"value": "庭院围墙门(耐候格栅 / 对开)"
|
"value": "yard"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "全屋室内门系统(通顶隐形)",
|
"label": "全屋室内门系统(通顶隐形)",
|
||||||
"value": "全屋室内门系统(通顶隐形)"
|
"value": "interior"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "背景墙一体门 / 密室门",
|
"label": "背景墙一体门 / 密室门",
|
||||||
"value": "背景墙一体门 / 密室门"
|
"value": "wall"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "整栋别墅门系统全案一体化",
|
"label": "整栋别墅门系统全案一体化",
|
||||||
"value": "整栋别墅门系统全案一体化"
|
"value": "whole-home"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -1458,19 +1515,19 @@
|
|||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
"label": "土建结构阶段(适合预埋加固)",
|
"label": "土建结构阶段(适合预埋加固)",
|
||||||
"value": "土建结构阶段(适合预埋加固)"
|
"value": "structure"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "水电木工阶段(适合精确测距)",
|
"label": "水电木工阶段(适合精确测距)",
|
||||||
"value": "水电木工阶段(适合精确测距)"
|
"value": "rough-in"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "硬装收尾阶段",
|
"label": "硬装收尾阶段",
|
||||||
"value": "硬装收尾阶段"
|
"value": "finishing"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "旧宅门体翻新改造",
|
"label": "旧宅门体翻新改造",
|
||||||
"value": "旧宅门体翻新改造"
|
"value": "renovation"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -1482,19 +1539,19 @@
|
|||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
"label": "5 万 - 10 万",
|
"label": "5 万 - 10 万",
|
||||||
"value": "5 万 - 10 万"
|
"value": "50k-100k"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "10 万 - 20 万",
|
"label": "10 万 - 20 万",
|
||||||
"value": "10 万 - 20 万"
|
"value": "100k-200k"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "20 万 - 50 万(全宅全案)",
|
"label": "20 万 - 50 万(全宅全案)",
|
||||||
"value": "20 万 - 50 万(全宅全案)"
|
"value": "200k-500k"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "50 万以上(顶级孤品定制)",
|
"label": "50 万以上(顶级孤品定制)",
|
||||||
"value": "50 万以上(顶级孤品定制)"
|
"value": "500k-plus"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -1539,18 +1596,18 @@
|
|||||||
"templateData": {
|
"templateData": {
|
||||||
"designPhilosophy": "先厘清问题,再设计表达"
|
"designPhilosophy": "先厘清问题,再设计表达"
|
||||||
},
|
},
|
||||||
"title": "门系统设计师",
|
"title": "高端门系统建筑研造主理人",
|
||||||
"slogan": "让门成为空间秩序的一部分。",
|
"slogan": "为当代别墅空间,定制有秩序感与呼吸感的门",
|
||||||
"phone": "",
|
"phone": "186-0218-9908",
|
||||||
"wechat": "",
|
"wechat": "LIN-ATELIER-2024",
|
||||||
"studioAddress": "上海·设计工作室",
|
"studioAddress": "上海市静安区威海路设计中心 A 座 / 杭州良渚研造工坊",
|
||||||
"avatarUrl": "/assets/content/personal-avatar.jpg",
|
"avatarUrl": "/media/seed/personal-avatar.jpg",
|
||||||
"heroImage": "/assets/content/doors-hero.jpg",
|
"heroImage": "/media/seed/doors-hero.jpg",
|
||||||
"visualPresentation": {
|
"visualPresentation": {
|
||||||
"home": {
|
"home": {
|
||||||
"founderBadge": "接受项目沟通",
|
"founderBadge": "接受项目沟通",
|
||||||
"proofEyebrow": "专业经验与合作成果",
|
"proofEyebrow": "专业经验与合作成果",
|
||||||
"proofTitle": "经验与方法",
|
"proofTitle": "14 年,只做门与空间的关系",
|
||||||
"manifestoEyebrow": "工作原则",
|
"manifestoEyebrow": "工作原则",
|
||||||
"manifestoTitle": "先厘清问题,再设计表达",
|
"manifestoTitle": "先厘清问题,再设计表达",
|
||||||
"worksEyebrow": "项目案例",
|
"worksEyebrow": "项目案例",
|
||||||
@@ -1588,7 +1645,7 @@
|
|||||||
"eyebrow": "COLLABORATION",
|
"eyebrow": "COLLABORATION",
|
||||||
"title": "合作咨询",
|
"title": "合作咨询",
|
||||||
"subtitle": "留下你的需求与目标,主理人会尽快联系。",
|
"subtitle": "留下你的需求与目标,主理人会尽快联系。",
|
||||||
"submitLabel": "提交咨询"
|
"submitLabel": "提交量房与定制评估需求"
|
||||||
},
|
},
|
||||||
"success": {
|
"success": {
|
||||||
"eyebrow": "COLLABORATION",
|
"eyebrow": "COLLABORATION",
|
||||||
@@ -1605,7 +1662,25 @@
|
|||||||
"emptyAction": "开始咨询"
|
"emptyAction": "开始咨询"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"founder": "示例主理人"
|
"founder": "林叙安 (Lin XUAN)",
|
||||||
|
"profilePresentation": {
|
||||||
|
"coverage": [
|
||||||
|
{
|
||||||
|
"title": "直派核心圈",
|
||||||
|
"content": "上海、杭州、宁波、苏州、无锡、南京及深圳、广州。主理人及资深装配总工亲赴现场。"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "全国其他城市私邸",
|
||||||
|
"content": "接受建筑设计师联合委托,安排远程 3D 激光测绘支持与专用物流直运安装。"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warranty": [
|
||||||
|
"门体内部防变形航空合金骨架承诺 10 年结构质保;",
|
||||||
|
"重型天地轴、进口地弹簧及磁吸五金 5 年免费维护;",
|
||||||
|
"每樘门出厂前进行 5000 次启闭校正;",
|
||||||
|
"原木天然肌理享有首年 2 次木蜡油保养服务。"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"personal": {
|
"personal": {
|
||||||
|
|||||||
Reference in new issue
Block a user