refactor: 移除测试代码并仅使用实际数据库数据
移除get_vip_last_booking.php和index.php中的测试代码和模拟数据功能,系统现在仅返回实际数据库中的预约记录数据
This commit is contained in:
@@ -66,21 +66,4 @@ echo json_encode($response);
|
||||
// 关闭数据库连接
|
||||
$conn = null;
|
||||
|
||||
// 如果在模拟环境中运行,提供测试数据
|
||||
if (isset($_GET['test']) && $_GET['test'] == 1) {
|
||||
// 生成测试数据
|
||||
$testResponse = [
|
||||
'has_booking' => true,
|
||||
'appointment_date' => date('Y-m-d', strtotime('-7 days')),
|
||||
'appointment_time' => '14:30',
|
||||
'package_name' => '豪华精洗套餐',
|
||||
'duration' => 90
|
||||
];
|
||||
|
||||
// 如果URL参数指定no_booking,则返回没有预约的结果
|
||||
if (isset($_GET['no_booking'])) {
|
||||
$testResponse = ['has_booking' => false];
|
||||
}
|
||||
|
||||
echo json_encode($testResponse);
|
||||
}
|
||||
// 系统现在只返回实际数据库中的预约记录数据
|
||||
@@ -1727,39 +1727,7 @@ $packages_json = json_encode(array_map(function($package) {
|
||||
const infoContainer = document.getElementById('vip_last_booking_info');
|
||||
const contentContainer = document.getElementById('last_booking_content');
|
||||
infoContainer.style.display = 'block';
|
||||
|
||||
// 生成模拟数据用于演示
|
||||
const isTestMode = true;
|
||||
if (isTestMode) {
|
||||
// 随机决定是否有预约记录
|
||||
const hasTestBooking = Math.random() > 0.3;
|
||||
if (hasTestBooking) {
|
||||
// 模拟有预约记录
|
||||
const testDate = new Date();
|
||||
testDate.setDate(testDate.getDate() - Math.floor(Math.random() * 30) - 1);
|
||||
const testTime = `${Math.floor(Math.random() * 12 + 9).toString().padStart(2, '0')}:${Math.floor(Math.random() * 2) * 30}`;
|
||||
const testPackages = ['标准洗车', '精洗套餐', '内饰深度清洁', '全车美容'];
|
||||
const randomPackage = testPackages[Math.floor(Math.random() * testPackages.length)];
|
||||
const randomDuration = [30, 60, 90, 120][Math.floor(Math.random() * 4)];
|
||||
|
||||
contentContainer.innerHTML = `
|
||||
<p style="margin-bottom: 8px;"><strong>👤 ${vipName}</strong></p>
|
||||
<p style="background-color: #fff3cd; padding: 5px; border-radius: 3px; font-size: 12px;">⚠️ 演示模式: 以下为模拟数据</p>
|
||||
<p>📅 <strong>预约时间:</strong> ${testDate.toISOString().split('T')[0]} ${testTime}</p>
|
||||
<p>💼 <strong>套餐类型:</strong> ${randomPackage}</p>
|
||||
<p>⏱️ <strong>施工时长:</strong> ${randomDuration} 分钟</p>
|
||||
`;
|
||||
} else {
|
||||
// 模拟首次到店
|
||||
contentContainer.innerHTML = `
|
||||
<p style="margin-bottom: 8px;"><strong>👤 ${vipName}</strong></p>
|
||||
<p style="color: #28a745; font-weight: bold;">🎉 欢迎首次到店!</p>
|
||||
<p>这是该VIP客户的首次预约,请为客户提供优质服务体验。</p>
|
||||
`;
|
||||
}
|
||||
} else {
|
||||
contentContainer.innerHTML = `<p style="color: #dc3545;">无法获取预约记录,请稍后重试。</p>`;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user