This repository has been archived on 2026-06-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
carwash_order/get_vip_customers.php
T
wsh5485 471aed949c feat(vip): 实现VIP客户管理功能并更新数据库配置
添加VIP客户管理页面和测试页面,更新数据库名称为carwash_booking
在SQL文件中添加示例VIP客户数据,完善VIP功能展示页面
2025-11-19 01:53:24 +08:00

34 lines
1021 B
PHP

<?php
header('Content-Type: application/json; charset=utf-8');
header('Cache-Control: no-cache, must-revalidate');
// 数据库连接配置
$host = 'localhost';
$dbname = 'carwash_booking';
$username = 'root';
$password = '';
try {
$pdo = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8mb4", $username, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// 查询所有VIP客户,按创建时间倒序排列
$stmt = $pdo->query("
SELECT id, customer_name, phone, car_model, car_number, email, birthday, is_active
FROM vip_customers
WHERE is_active = 1
ORDER BY created_at DESC
");
$vipCustomers = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($vipCustomers, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
} catch(PDOException $e) {
http_response_code(500);
echo json_encode([
'error' => '数据库连接失败',
'message' => $e->getMessage()
], JSON_UNESCAPED_UNICODE);
}
?>