Files
work_dhd_back_end/test_match_pass.php

83 lines
2.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// 测试通过硬性条件的案例
require __DIR__ . '/vendor/autoload.php';
// 岗位信息
$position = [
"position_require" => [
"学历要求" => "本科及以上",
"学位要求" => "学士及以上",
"年龄要求" => "18周岁以上、35周岁以下。",
"其他资格条件" => "适合男性。",
"专业(学科)类别" => "计算机科学与技术类,电气、电子及自动化类"
]
];
// 简历信息(符合硬性条件)
$resume = [
"birth_date" => "1995-03-01", // 29岁符合年龄要求
"gender" => "",
"work_experience" => "3年基层工作年限",
"education" => [
[
"education_level" => "硕士研究生",
"degree" => "硕士",
"majors_name" => "计算机科学与技术"
]
]
];
// 加载ThinkPHP框架
$app = new think\App();
$app->initialize();
// 创建匹配服务实例
$matchService = new app\service\MatchService();
// 计算匹配度
$result = $matchService->calculateMatchScore($position, $resume);
// 输出结果
echo "========================================\n";
echo "岗位简历匹配度测试(通过硬性条件案例)\n";
echo "========================================\n\n";
echo "【硬性条件检查结果】\n";
echo "----------------------------------------\n";
if ($result['qualified']) {
echo "✓ 通过硬性条件筛选\n\n";
foreach ($result['hard_requirements']['details'] as $key => $detail) {
if (isset($detail['passed'])) {
$status = $detail['passed'] ? '✓' : '✗';
echo "{$status} {$key}: ";
if ($detail['passed']) {
echo "通过 (要求: {$detail['required']}, 实际: {$detail['actual']})\n";
} else {
echo "不通过 - {$detail['reason']}\n";
}
}
}
} else {
echo "✗ 未通过硬性条件筛选\n";
foreach ($result['rejection_reasons'] as $reason) {
echo " - {$reason}\n";
}
}
echo "\n【软性条件评分结果】\n";
echo "----------------------------------------\n";
if ($result['qualified']) {
echo "总分: {$result['score']}/{$result['soft_requirements']['max_score']}\n\n";
foreach ($result['soft_requirements']['details'] as $key => $detail) {
echo "{$key}: {$detail['score']}/{$detail['max_score']}分 - {$detail['reason']}\n";
}
} else {
echo "(未通过硬性条件筛选,不进行软性条件评分)\n";
}
echo "\n========================================\n";
echo "最终结果: " . ($result['qualified'] ? "✓ 符合条件,匹配度 {$result['score']}/100分" : "✗ 不符合条件") . "\n";
echo "========================================\n";