| 12345678910111213141516171819202122232425 |
- const { PrismaClient } = require('@prisma/client');
- const prisma = new PrismaClient();
- async function cleanMyAudioBooks() {
- console.log('\n🧹 清理错误的"我的音频"书籍...\n');
-
- // 删除所有标题为"我的音频"且章节数为1的书籍
- const result = await prisma.book.deleteMany({
- where: {
- title: '我的音频',
- description: '我的语音合成音频收藏',
- chapters: {
- none: {
- level: { gt: 1 } // 没有level>1的章节(说明不是正常的书籍)
- }
- }
- }
- });
-
- console.log(`✅ 已删除 ${result.count} 本错误的"我的音频"书籍\n`);
-
- await prisma.$disconnect();
- }
- cleanMyAudioBooks().catch(console.error);
|