const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient();

async function checkAudioUrl() {
  console.log('\n📊 检查ID 1162的音频URL：\n');
  
  const chapter = await prisma.bookChapter.findUnique({
    where: { id: 1162 }
  });
  
  if (!chapter) {
    console.log('❌ 找不到该章节\n');
    await prisma.$disconnect();
    return;
  }
  
  console.log(`章节: ${chapter.title}`);
  console.log(`ID: ${chapter.id}`);
  console.log(`Level: ${chapter.level}`);
  console.log(`audioUrl: ${chapter.audioUrl || '无'}`);
  console.log(`audioDuration: ${chapter.audioDuration || 0}秒\n`);
  
  // 检查是否有对应的AudioRecord
  const audioRecord = await prisma.audioRecord.findFirst({
    where: {
      chapterId: 1162
    }
  });
  
  if (audioRecord) {
    console.log('找到AudioRecord：');
    console.log(`  ID: ${audioRecord.id}`);
    console.log(`  audioUrl: ${audioRecord.audioUrl || '无'}`);
    console.log(`  status: ${audioRecord.status}\n`);
  } else {
    console.log('❌ 没有找到AudioRecord\n');
  }
  
  await prisma.$disconnect();
}

checkAudioUrl().catch(console.error);
