<?php
require_once dirname(__DIR__) . '/config.php';

header('Content-Type: application/json');

$order_no = $_GET['order_no'] ?? '';

if (empty($order_no)) {
    echo json_encode(['status' => 'error', 'message' => '订单号不能为空']);
    exit;
}

$order = $db->fetchOne("SELECT status FROM orders WHERE order_no = '$order_no'");

if ($order) {
    echo json_encode(['status' => $order['status']]);
} else {
    echo json_encode(['status' => 'not_found']);
}
?>