<?php
require __DIR__ . '/vendor/autoload.php';

$app = require_once __DIR__ . '/bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$kernel->bootstrap();

$pdo = new PDO('mysql:host=120.78.197.180;dbname=math;charset=utf8mb4', 'root', 'bamasoso902');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$stmt = $pdo->prepare('SELECT * FROM papers WHERE paper_id = ?');
$stmt->execute(['paper_1765263438_26997949']);
$paper = $stmt->fetch(PDO::FETCH_ASSOC);

if ($paper) {
    echo "=== 试卷基本信息 ===\n";
    print_r($paper);
    
    echo "\n=== 试卷题目详情 ===\n";
    $stmt2 = $pdo->prepare('SELECT * FROM paper_questions WHERE paper_id = ? ORDER BY question_number');
    $stmt2->execute(['paper_1765263438_26997949']);
    $questions = $stmt2->fetchAll(PDO::FETCH_ASSOC);
    
    echo "题目数量: " . count($questions) . "\n\n";
    foreach ($questions as $i => $q) {
        echo "=== 第{$q['question_number']}题 ===\n";
        echo "Question ID: {$q['question_bank_id']}\n";
        echo "Question Text:\n{$q['question_text']}\n";
        echo "Knowledge Point: {$q['knowledge_point']}\n";
        echo "Question Type: {$q['question_type']}\n";
        echo "Score: {$q['score']}\n";
        echo "Correct Answer: {$q['correct_answer']}\n";
        echo "\n";
    }
}
