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/test/debug_vip.php
T
wsh5485 0eb0cf12fb chore: 删除测试和调试相关文件
移除不再需要的测试脚本、调试页面和解决方案文档,包括:
- 各种测试PHP文件(test.php, test_filters.php等)
- VIP功能测试和调试页面(test_vip*.php, vip_debug_page.html等)
- 数据库连接测试脚本(test_db_connection.php)
- 解决方案文档(SOLUTIONS.md, VIP_*_Report.md)
2025-12-05 01:38:06 +08:00

54 lines
1.8 KiB
PHP

<?php
// 简化版VIP客户测试
header('Content-Type: text/plain; charset=utf-8');
echo "=== VIP客户搜索问题诊断 ===\n\n";
// 1. 检查数据库连接
echo "1. 测试数据库连接...\n";
try {
require_once 'db_connect.php';
echo "✅ 数据库连接成功\n";
// 2. 检查VIP客户表
echo "\n2. 检查VIP客户表...\n";
$stmt = $pdo->query("SELECT COUNT(*) as count FROM vip_customers");
$result = $stmt->fetch();
echo "VIP客户表记录总数: {$result['count']}\n";
// 3. 检查活跃状态
echo "\n3. 检查活跃VIP客户...\n";
$stmt = $pdo->query("SELECT COUNT(*) as count FROM vip_customers WHERE is_active = 1");
$result = $stmt->fetch();
echo "活跃VIP客户数: {$result['count']}\n";
// 4. 显示所有VIP客户详情
echo "\n4. 所有VIP客户详情:\n";
$stmt = $pdo->query("SELECT * FROM vip_customers ORDER BY created_at DESC");
$customers = $stmt->fetchAll();
foreach ($customers as $customer) {
echo " - ID: {$customer['id']}\n";
echo " 姓名: {$customer['customer_name']}\n";
echo " 手机: {$customer['phone']}\n";
echo " 活跃: " . ($customer['is_active'] ? '是' : '否') . "\n";
echo " 创建时间: {$customer['created_at']}\n";
echo " ---\n";
}
// 5. 测试API接口
echo "\n5. 测试VIP客户API...\n";
$response = @file_get_contents('http://localhost/get_vip_customers.php');
if ($response === false) {
echo "❌ 无法访问API接口,请检查PHP服务器是否运行\n";
} else {
echo "API返回数据:\n";
echo $response . "\n";
}
} catch (Exception $e) {
echo "❌ 错误: " . $e->getMessage() . "\n";
}
echo "\n=== 诊断完成 ===\n";
?>