feat: 添加调试日志并改进数据库处理逻辑
- 在多个文件中添加调试日志记录功能 - 将数据库连接统一迁移到db_connect.php - 改进预约时间冲突检测逻辑 - 优化VIP客户数据处理 - 增强套餐查询的健壮性 - 更新预约状态处理流程
This commit is contained in:
+10
-1
@@ -62,7 +62,16 @@ try {
|
||||
}
|
||||
|
||||
// 计算新的持续时间(分钟)
|
||||
$duration = $start_dt->diff($end_dt)->i + ($start_dt->diff($end_dt)->h * 60);
|
||||
// #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']);
|
||||
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']);
|
||||
file_put_contents('.cursor/debug.log', $log_data . "\n", FILE_APPEND);
|
||||
// #endregion
|
||||
|
||||
// 更新预约时间和持续时间
|
||||
$stmt = $pdo->prepare("UPDATE bookings SET start_time = ?, end_time = ?, duration = ?, updated_at = CURRENT_TIMESTAMP WHERE id = ?");
|
||||
|
||||
Reference in New Issue
Block a user