check-books-3-4.js 586 B

123456789101112131415161718192021222324
  1. const { PrismaClient } = require('@prisma/client');
  2. const prisma = new PrismaClient();
  3. async function checkBooks() {
  4. const books = await prisma.book.findMany({
  5. where: { id: { in: [3, 4] } },
  6. select: {
  7. id: true,
  8. title: true,
  9. status: true,
  10. progress: true,
  11. errorMsg: true,
  12. }
  13. });
  14. console.log('书籍状态:');
  15. books.forEach(b => {
  16. console.log(`bookId=${b.id}, title=${b.title}, status=${b.status}, progress=${b.progress}%, error=${b.errorMsg || '无'}`);
  17. });
  18. await prisma.$disconnect();
  19. }
  20. checkBooks().catch(console.error);