feat: 将阿成信任内容迁移为品牌数据

This commit is contained in:
que01 committed 2026-09-27 11:14:34 +08:00
1 parent 55989a5dfe
commit 774ae2c8e3
19 files changed
+142 -35

No files matched your search

+47 -13
View File
@@ -272,11 +272,39 @@ const runtimeSeedTemplates: Record<"personal" | "food" | "doors", RuntimeSeedTem
},
],
trustContent: [
{ type: "profile", title: "关于阿成", content: "每天认真做好一顿家常饭。" },
{
type: "schedule",
title: "每周出摊日程",
summary: "周一至周五晚餐与夜宵档",
content: "二号校门外小吃商业街 · 17:00 - 22:30\n周六、周日承接团体单与夜市流动出摊",
},
{
type: "coverage",
title: "取餐与配送范围",
summary: "提前预订,按约定时间取餐或配送",
content: "摊位现场自取;满 3 份可配送至校内宿舍楼栋或实验楼门前。",
},
{
type: "process",
title: "认真做饭的流程",
content: "提前准备食材,现做现出餐,认真沟通每一次需求。",
title: "定制餐品流程",
summary: "从需求沟通到保温交付",
content: "提交基本需求\n确认菜单与预算\n当日新鲜烹饪打包\n保温直达交付",
},
{
type: "credential",
title: "食品安全与制作承诺",
content: "当天采购,现做现出餐;食具每日清洁消毒,按约定标注和分装。",
},
{
type: "case",
title: "他们都在阿成这订过餐",
content:
"校街舞社年度专场 · 52 人份\n信息学院科创竞赛 · 连签 5 天\n7 号楼庆功宴 · 8 人定制",
},
{
type: "promise",
title: "回复承诺",
content: "备料期 15 分钟内联系,出摊高峰 1 小时内回复。",
},
],
inquiryForm: {
@@ -661,14 +689,21 @@ async function ensureRuntimeContent(brandId: string, template: RuntimeSeedTempla
}
: {}),
}));
const trustContent = packageSample?.trustContent?.length
? packageSample.trustContent.map((item, index) => ({
...template.trustContent[index],
type: item.type,
title: item.title,
content: item.content,
}))
: template.trustContent;
// 模板 package 的 sampleContent 只用于导入预览;演示品牌使用明确的品牌 fixture,
// 避免把模板示例内容误当成所有品牌的数据库初始数据。
const trustContent = template.trustContent;
const inquiryFields = (packageSample?.fields ?? template.inquiryForm.fieldsSnapshot).map(
(field) => ({
...field,
...(Array.isArray(field.options)
? {
options: field.options.map((option) =>
typeof option === "string" ? { label: option, value: option } : option,
),
}
: {}),
}),
);
await prisma.brandProfile.update({
where: { id: brandId },
data: {
@@ -739,8 +774,7 @@ async function ensureRuntimeContent(brandId: string, template: RuntimeSeedTempla
purpose: "inquiry",
targetType: "brand",
submissionAction: "create-inquiry",
fieldsSnapshot: (packageSample?.fields ??
template.inquiryForm.fieldsSnapshot) as Prisma.InputJsonValue,
fieldsSnapshot: inquiryFields as Prisma.InputJsonValue,
isEnabled: true,
} as const;
if (existingForm)