- 新增 Music 数据模型 + 迁移(title/subtitle/audioFile) - 后端:公共 /api/music 查询接口 + 管理端 CRUD (音频上传专用 multer,限制 20MB) - 移动端 /music/:id 播放页: - 金色印章式唱片 + 旋转虚线环 + 三重金色涟漪 - preload=auto + HTTP Range 流式加载 - 浏览器禁止 autoplay 时显示「轻点聆听」overlay - 自定义进度条与时间显示 - Admin:新增音乐管理三页(列表/表单/二维码)与侧栏入口 - 导入示例音乐:朝天宫之歌 - Dockerfile + entrypoint 增加 music 资产回灌 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
46 lines
965 B
TypeScript
46 lines
965 B
TypeScript
import { prisma } from "@stamp/shared";
|
|
|
|
const tracks = [
|
|
{
|
|
title: "朝天宫之歌",
|
|
subtitle: "金陵千年韵",
|
|
audioFile: "/uploads/music/chaotiangong.m4a",
|
|
},
|
|
];
|
|
|
|
async function seed() {
|
|
console.log("Seeding music...");
|
|
|
|
await prisma.music.deleteMany();
|
|
|
|
const created = [];
|
|
for (let i = 0; i < tracks.length; i++) {
|
|
const t = tracks[i];
|
|
const music = await prisma.music.create({
|
|
data: {
|
|
title: t.title,
|
|
subtitle: t.subtitle,
|
|
audioFile: t.audioFile,
|
|
sortOrder: i + 1,
|
|
enabled: true,
|
|
},
|
|
});
|
|
created.push(music);
|
|
}
|
|
|
|
console.log(`Created ${created.length} music track(s)`);
|
|
console.log("\nMusic IDs for testing:");
|
|
created.forEach((m) => {
|
|
console.log(` ${m.sortOrder}. ${m.title}: /music/${m.id}`);
|
|
});
|
|
|
|
console.log("\nSeed complete!");
|
|
}
|
|
|
|
seed()
|
|
.catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
})
|
|
.finally(() => prisma.$disconnect());
|