where(array( 'state' => 1, 'status' => 1 ))->field('id,login_name,password,user_type,name,add_time')->limit(10)->select(); if ($users) { echo "找到 " . count($users) . " 个活跃用户:\n"; foreach ($users as $user) { echo "ID: {$user['id']}, 登录名: {$user['login_name']}, 用户类型: {$user['user_type']}, 姓名: {$user['name']}, 添加时间: {$user['add_time']}\n"; echo "密码哈希: " . substr($user['password'], 0, 20) . "...\n"; echo "---\n"; } } else { echo "未找到活跃用户\n"; } // 查询特定用户 echo "\n=== 查询特定用户 13888888888 ===\n"; $specificUser = $JurisdictionUserModel->where(array( 'login_name' => '13888888888', 'state' => 1, 'status' => 1 ))->find(); if ($specificUser) { echo "找到用户:\n"; print_r($specificUser); // 测试密码验证 echo "\n=== 测试密码验证 ===\n"; $testPasswords = ['123456', '888888', 'admin', 'password']; foreach ($testPasswords as $pwd) { $isValid = checkPassword($specificUser['password'], $pwd, $specificUser['add_time']); echo "密码 '{$pwd}': " . ($isValid ? '正确' : '错误') . "\n"; } } else { echo "未找到用户 13888888888\n"; } // 显示最后执行的SQL echo "\n=== 最后执行的SQL ===\n"; echo $JurisdictionUserModel->getLastSql() . "\n"; ?>