| 12345678910111213141516171819202122232425262728293031323334 |
- const { PrismaClient } = require('@prisma/client');
- const prisma = new PrismaClient();
- async function checkBook2() {
- const book = await prisma.book.findUnique({
- where: { id: 2 },
- select: {
- id: true,
- title: true,
- status: true,
- progress: true,
- errorMsg: true,
- bookScale: true,
- }
- });
-
- console.log('Book ID 2 状态:');
- console.log(JSON.stringify(book, null, 2));
-
- if (book) {
- const chapters = await prisma.bookChapter.count({ where: { bookId: 2, level: 1 } });
- const sections = await prisma.bookChapter.count({ where: { bookId: 2, level: 2 } });
- const subsections = await prisma.bookChapter.count({ where: { bookId: 2, level: 3 } });
- const completed = await prisma.bookChapter.count({ where: { bookId: 2, level: 3, contentStatus: 'completed' } });
-
- console.log(`\n大纲: ${chapters}章, ${sections}节, ${subsections}小节`);
- console.log(`已完成内容: ${completed}`);
- console.log(`错误信息: ${book.errorMsg || '无'}`);
- }
-
- await prisma.$disconnect();
- }
- checkBook2().catch(console.error);
|