| 123456789101112131415161718192021222324252627282930313233343536 |
- const { PrismaClient } = require('@prisma/client');
- const prisma = new PrismaClient();
- async function checkContent() {
- const bookId = 5;
-
- const completedSubsections = await prisma.bookChapter.findMany({
- where: {
- bookId,
- level: 3,
- contentStatus: 'completed'
- },
- select: {
- id: true,
- title: true,
- content: true,
- wordCount: true,
- },
- orderBy: { id: 'asc' },
- take: 3
- });
-
- console.log(`\n📝 已完成的内容(前3个小节):\n`);
-
- completedSubsections.forEach((sub, index) => {
- console.log(`\n${index + 1}. ${sub.title}`);
- console.log(` 字数: ${sub.wordCount}`);
- console.log(` 内容预览:\n${sub.content.substring(0, 300)}...\n`);
- });
-
- console.log(`\n✅ 验证成功!内容已写入数据库`);
-
- await prisma.$disconnect();
- }
- checkContent().catch(console.error);
|