diff --git a/index.php b/index.php index 4839d3b..cf9fe8e 100644 --- a/index.php +++ b/index.php @@ -32,6 +32,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $phone = $vip_customer['phone']; // #region agent log $log_data = json_encode(['location' => 'index.php:28', 'message' => 'VIP customer data', 'data' => ['vip_id' => $vip_id, 'has_car_model' => isset($vip_customer['car_model']), 'has_car_number' => isset($vip_customer['car_number'])], 'timestamp' => time() * 1000, 'sessionId' => 'debug-session', 'runId' => 'run1', 'hypothesisId' => 'A']); + // 确保日志目录存在 + $log_dir = '.cursor'; + if (!file_exists($log_dir)) { + mkdir($log_dir, 0777, true); + } file_put_contents('.cursor/debug.log', $log_data . "\n", FILE_APPEND); // #endregion // VIP客户信息优先,但允许通过POST覆盖(如果用户想修改) @@ -116,6 +121,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { // 两个时间段重叠的条件:现有预约的开始时间 < 新预约的结束时间 AND 现有预约的结束时间 > 新预约的开始时间 // #region agent log $log_data = json_encode(['location' => 'index.php:98', 'message' => 'Checking time conflict', 'data' => ['start_time' => $start_time, 'end_time' => $end_time, 'duration' => $duration], 'timestamp' => time() * 1000, 'sessionId' => 'debug-session', 'runId' => 'run1', 'hypothesisId' => 'F']); + // 确保日志目录存在 + $log_dir = '.cursor'; + if (!file_exists($log_dir)) { + mkdir($log_dir, 0777, true); + } file_put_contents('.cursor/debug.log', $log_data . "\n", FILE_APPEND); // #endregion $stmt = $pdo->prepare("SELECT COUNT(*) FROM bookings @@ -126,6 +136,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $conflict_count = $stmt->fetchColumn(); // #region agent log $log_data = json_encode(['location' => 'index.php:107', 'message' => 'Time conflict check result', 'data' => ['conflict_count' => $conflict_count], 'timestamp' => time() * 1000, 'sessionId' => 'debug-session', 'runId' => 'run1', 'hypothesisId' => 'F']); + // 确保日志目录存在 + $log_dir = '.cursor'; + if (!file_exists($log_dir)) { + mkdir($log_dir, 0777, true); + } file_put_contents('.cursor/debug.log', $log_data . "\n", FILE_APPEND); // #endregion @@ -216,6 +231,11 @@ foreach ($all_bookings as $booking) { // #region agent log $log_data = json_encode(['location' => 'index.php:196', 'message' => 'Checking cross-day booking', 'data' => ['booking_date' => $booking_date, 'start_time' => $booking_start_time, 'end_time' => $booking_end_time, 'start_ts' => $start_timestamp, 'end_ts' => $end_timestamp], 'timestamp' => time() * 1000, 'sessionId' => 'debug-session', 'runId' => 'run1', 'hypothesisId' => 'G']); + // 确保日志目录存在 + $log_dir = '.cursor'; + if (!file_exists($log_dir)) { + mkdir($log_dir, 0777, true); + } file_put_contents('.cursor/debug.log', $log_data . "\n", FILE_APPEND); // #endregion diff --git a/process_booking.php b/process_booking.php index ad6526b..d50c01f 100644 --- a/process_booking.php +++ b/process_booking.php @@ -3,6 +3,11 @@ require_once 'db_connect.php'; // #region agent log $log_data = json_encode(['location' => 'process_booking.php:3', 'message' => 'Database connection check', 'data' => ['has_pdo' => isset($pdo), 'using_db_connect' => true], 'timestamp' => time() * 1000, 'sessionId' => 'debug-session', 'runId' => 'run1', 'hypothesisId' => 'D']); +// 确保日志目录存在 +$log_dir = '.cursor'; +if (!file_exists($log_dir)) { + mkdir($log_dir, 0777, true); +} file_put_contents('.cursor/debug.log', $log_data . "\n", FILE_APPEND); // #endregion @@ -108,6 +113,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { // #region agent log $log_data = json_encode(['location' => 'process_booking.php:70', 'message' => 'Time conversion', 'data' => ['booking_date' => $booking_date, 'time_slot' => $time_slot, 'start_time' => $start_time, 'end_time' => $end_time, 'duration' => $duration], 'timestamp' => time() * 1000, 'sessionId' => 'debug-session', 'runId' => 'run1', 'hypothesisId' => 'E']); + // 确保日志目录存在 + $log_dir = '.cursor'; + if (!file_exists($log_dir)) { + mkdir($log_dir, 0777, true); + } file_put_contents('.cursor/debug.log', $log_data . "\n", FILE_APPEND); // #endregion @@ -136,6 +146,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { // 两个时间段重叠的条件:现有预约的开始时间 < 新预约的结束时间 AND 现有预约的结束时间 > 新预约的开始时间 // #region agent log $log_data = json_encode(['location' => 'process_booking.php:100', 'message' => 'Checking time conflict', 'data' => ['start_time' => $start_time, 'end_time' => $end_time], 'timestamp' => time() * 1000, 'sessionId' => 'debug-session', 'runId' => 'run1', 'hypothesisId' => 'H']); + // 确保日志目录存在 + $log_dir = '.cursor'; + if (!file_exists($log_dir)) { + mkdir($log_dir, 0777, true); + } file_put_contents('.cursor/debug.log', $log_data . "\n", FILE_APPEND); // #endregion $stmt = $pdo->prepare("SELECT COUNT(*) FROM bookings @@ -146,6 +161,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $conflict_count = $stmt->fetchColumn(); // #region agent log $log_data = json_encode(['location' => 'process_booking.php:110', 'message' => 'Time conflict check result', 'data' => ['conflict_count' => $conflict_count], 'timestamp' => time() * 1000, 'sessionId' => 'debug-session', 'runId' => 'run1', 'hypothesisId' => 'H']); + // 确保日志目录存在 + $log_dir = '.cursor'; + if (!file_exists($log_dir)) { + mkdir($log_dir, 0777, true); + } file_put_contents('.cursor/debug.log', $log_data . "\n", FILE_APPEND); // #endregion diff --git a/update_booking.php b/update_booking.php index d964a09..31ecdbd 100644 --- a/update_booking.php +++ b/update_booking.php @@ -64,12 +64,22 @@ try { // 计算新的持续时间(分钟) // #region agent log $log_data = json_encode(['location' => 'update_booking.php:65', 'message' => 'Calculating duration', 'data' => ['start_time' => $new_start_time, 'end_time' => $new_end_time], 'timestamp' => time() * 1000, 'sessionId' => 'debug-session', 'runId' => 'run1', 'hypothesisId' => 'C']); + // 确保日志目录存在 + $log_dir = '.cursor'; + if (!file_exists($log_dir)) { + mkdir($log_dir, 0777, true); + } file_put_contents('.cursor/debug.log', $log_data . "\n", FILE_APPEND); // #endregion $interval = $start_dt->diff($end_dt); $duration = ($interval->days * 24 * 60) + ($interval->h * 60) + $interval->i; // #region agent log $log_data = json_encode(['location' => 'update_booking.php:67', 'message' => 'Duration calculated', 'data' => ['duration' => $duration, 'days' => $interval->days, 'hours' => $interval->h, 'minutes' => $interval->i], 'timestamp' => time() * 1000, 'sessionId' => 'debug-session', 'runId' => 'run1', 'hypothesisId' => 'C']); + // 确保日志目录存在 + $log_dir = '.cursor'; + if (!file_exists($log_dir)) { + mkdir($log_dir, 0777, true); + } file_put_contents('.cursor/debug.log', $log_data . "\n", FILE_APPEND); // #endregion diff --git a/vip.php b/vip.php index 22adb4b..7210fab 100644 --- a/vip.php +++ b/vip.php @@ -416,6 +416,11 @@ try { // 查询所有可用的洗车套餐 // #region agent log $log_data = json_encode(['location' => 'vip.php:417', 'message' => 'Loading packages', 'data' => ['using_pdo' => isset($pdo), 'using_conn' => isset($conn)], 'timestamp' => time() * 1000, 'sessionId' => 'debug-session', 'runId' => 'run1', 'hypothesisId' => 'B']); + // 确保日志目录存在 + $log_dir = '.cursor'; + if (!file_exists($log_dir)) { + mkdir($log_dir, 0777, true); + } file_put_contents('.cursor/debug.log', $log_data . "\n", FILE_APPEND); // #endregion try {