check-prod.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. const { PrismaClient } = require('@prisma/client');
  2. const p = new PrismaClient();
  3. (async () => {
  4. // 1. book 43 真实状态
  5. const b = await p.book.findUnique({
  6. where: { id: 43 },
  7. select: { id: true, title: true, userId: true, genStage: true, failedStage: true, errorMsg: true, progress: true, totalChapters: true, updatedAt: true, createdAt: true },
  8. });
  9. console.log('=== book 43 ===');
  10. console.log(JSON.stringify(b, null, 2));
  11. // 2. book 43 的章节
  12. const chapters = await p.bookChapter.findMany({
  13. where: { bookId: 43 },
  14. select: { id: true, number: true, title: true, level: true, genStage: true, contentStatus: true, contentError: true, contentLength: true },
  15. });
  16. console.log('\n=== chapters ===');
  17. console.log(JSON.stringify(chapters, null, 2));
  18. // 3. 全部 failed 状态的书(按时间倒序)
  19. const failed = await p.book.findMany({
  20. where: { OR: [{ genStage: 'failed' }, { failedStage: { not: null } }] },
  21. select: { id: true, title: true, userId: true, genStage: true, failedStage: true, errorMsg: true, progress: true, totalChapters: true, updatedAt: true },
  22. orderBy: { updatedAt: 'desc' },
  23. take: 10,
  24. });
  25. console.log('\n=== failed books (latest 10) ===');
  26. failed.forEach(bk => console.log(JSON.stringify(bk)));
  27. // 4. 找 errorMsg 含 "Request timed out" 的所有书
  28. const t = await p.book.findMany({
  29. where: { errorMsg: { contains: 'Request timed out' } },
  30. select: { id: true, title: true, userId: true, genStage: true, failedStage: true, errorMsg: true, updatedAt: true },
  31. orderBy: { updatedAt: 'desc' },
  32. });
  33. console.log('\n=== books with "Request timed out" in errorMsg ===');
  34. t.forEach(bk => console.log(JSON.stringify(bk)));
  35. await p.$disconnect();
  36. })();