From 5561291dbe5619a809a769bc68ce3318c6fcefd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=B1=95=E9=B9=8F?= Date: Wed, 19 Nov 2025 01:22:36 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E9=A2=84?= =?UTF-8?q?=E7=BA=A6=E7=B3=BB=E7=BB=9F=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E5=B9=B6=E6=94=B9=E8=BF=9B=E6=97=A5=E6=9C=9F=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除packages.php中的会话检查,改为统一入口控制 - 在index.php中优化日期初始化逻辑并添加默认日期选择 - 重构bookings.php的查询逻辑,关联套餐表并改进时间显示格式 --- bookings.php | 8 ++++---- index.php | 8 ++++++-- packages.php | 7 ------- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/bookings.php b/bookings.php index 7f0fcbf..074d43f 100644 --- a/bookings.php +++ b/bookings.php @@ -20,7 +20,7 @@ if (isset($_POST['action']) && isset($_POST['booking_id'])) { // 获取所有预约 try { - $stmt = $pdo->query("SELECT * FROM bookings ORDER BY appointment_date DESC, appointment_time DESC"); + $stmt = $pdo->query("SELECT b.*, p.package_name FROM bookings b LEFT JOIN packages p ON b.package_id = p.id ORDER BY b.start_time DESC"); $bookings = $stmt->fetchAll(); } catch (Exception $e) { $error_message = '获取预约列表失败:' . $e->getMessage(); @@ -95,13 +95,13 @@ try { 车牌号:
- 服务类型: + 服务套餐:
- 预约日期: + 预约日期:
- 预约时间: + 预约时间: -
diff --git a/index.php b/index.php index 7798a76..32872a3 100644 --- a/index.php +++ b/index.php @@ -306,8 +306,12 @@ $packages_json = json_encode(array_map(function($package) { document.addEventListener('DOMContentLoaded', function() { const today = new Date(); today.setDate(today.getDate()); - document.getElementById('appointment_date').value = today.toISOString().split('T')[0]; - selectedDate = today.toISOString().split('T')[0]; + const todayStr = today.toISOString().split('T')[0]; + document.getElementById('appointment_date').value = todayStr; + selectedDate = todayStr; + + // 默认选择今天的日期并显示时间段 + selectDate(todayStr); // 移动端优化 if (/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent)) { diff --git a/packages.php b/packages.php index 45b6d6d..ed5d9a7 100644 --- a/packages.php +++ b/packages.php @@ -1,13 +1,6 @@