1
This commit is contained in:
@@ -85,8 +85,9 @@ class DeliverHandler extends BaseHandler {
|
||||
// 5. 获取职位类型配置
|
||||
const jobTypeConfig = await this.getJobTypeConfig(accountConfig.job_type_id);
|
||||
|
||||
// 6. 搜索职位列表
|
||||
await this.searchJobs(sn_code, platform, keyword || accountConfig.keyword, pageCount, task.id);
|
||||
// 6. 搜索职位列表(从 resume_info 取 deliver_tab_label 作为 tabLabel 下发给 get_job_list 切换期望 tab)
|
||||
const tabLabel = resume.deliver_tab_label || '';
|
||||
await this.searchJobs(sn_code, platform, keyword || accountConfig.keyword, pageCount, task.id, tabLabel);
|
||||
|
||||
// 7. 从数据库获取待投递职位
|
||||
const pendingJobs = await this.getPendingJobs(sn_code, platform, actualMaxCount * 3);
|
||||
@@ -238,17 +239,22 @@ class DeliverHandler extends BaseHandler {
|
||||
|
||||
/**
|
||||
* 搜索职位列表
|
||||
* @param {string} tabLabel - 投递用期望标签文案,对应 resume_info.deliver_tab_label,get_job_list 会按此选择 tab
|
||||
*/
|
||||
async searchJobs(sn_code, platform, keyword, pageCount, taskId) {
|
||||
async searchJobs(sn_code, platform, keyword, pageCount, taskId, tabLabel = '') {
|
||||
const params = {
|
||||
sn_code,
|
||||
keyword,
|
||||
platform,
|
||||
pageCount
|
||||
};
|
||||
if (tabLabel != null && String(tabLabel).trim() !== '') {
|
||||
params.tabLabel = String(tabLabel).trim();
|
||||
}
|
||||
const getJobListCommand = {
|
||||
command_type: 'get_job_list',
|
||||
command_name: 'get_job_list',
|
||||
command_params: JSON.stringify({
|
||||
sn_code,
|
||||
keyword,
|
||||
platform,
|
||||
pageCount
|
||||
}),
|
||||
command_params: JSON.stringify(params),
|
||||
priority: config.getTaskPriority('search_jobs') || 5
|
||||
};
|
||||
|
||||
@@ -337,18 +343,22 @@ class DeliverHandler extends BaseHandler {
|
||||
*/
|
||||
async filterAndScoreJobs(jobs, resume, accountConfig, jobTypeConfig, filterConfig, recentCompanies) {
|
||||
const scored = [];
|
||||
const jobDesc = (j) => `${j.companyName || '?'} / ${j.jobTitle || '?'}`;
|
||||
|
||||
console.log(`[自动投递-过滤] 开始过滤与评分,待处理职位数: ${jobs.length}`);
|
||||
|
||||
for (const job of jobs) {
|
||||
// 1. 过滤近期已投递的公司
|
||||
if (job.companyName && recentCompanies.has(job.companyName)) {
|
||||
console.log(`[自动投递] 跳过已投递公司: ${job.companyName}`);
|
||||
console.log(`[自动投递-过滤] 步骤1-已投递公司 剔除: ${jobDesc(job)}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 2. 使用 jobFilterEngine 过滤和评分
|
||||
const filtered = await jobFilterEngine.filterJobs([job], filterConfig, resume);
|
||||
if (filtered.length === 0) {
|
||||
continue; // 不符合过滤条件
|
||||
console.log(`[自动投递-过滤] 步骤2-jobFilterEngine 剔除: ${jobDesc(job)} (不满足过滤条件)`);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 3. 使用原有的评分系统(job_filter_service)计算详细分数
|
||||
@@ -371,21 +381,26 @@ class DeliverHandler extends BaseHandler {
|
||||
const finalScore = scoreResult.totalScore + keywordBonus.score;
|
||||
|
||||
// 5. 只保留评分 >= 60 的职位
|
||||
if (finalScore >= 60) {
|
||||
scored.push({
|
||||
...job,
|
||||
matchScore: finalScore,
|
||||
scoreDetails: {
|
||||
...scoreResult.scores,
|
||||
keywordBonus: keywordBonus.score
|
||||
}
|
||||
});
|
||||
if (finalScore < 60) {
|
||||
console.log(`[自动投递-过滤] 步骤5-评分不足(>=60) 剔除: ${jobDesc(job)} | 总分=${finalScore.toFixed(1)} (基础=${scoreResult.totalScore?.toFixed(1)}, 关键词奖励=${keywordBonus.score})`);
|
||||
continue;
|
||||
}
|
||||
|
||||
scored.push({
|
||||
...job,
|
||||
matchScore: finalScore,
|
||||
scoreDetails: {
|
||||
...scoreResult.scores,
|
||||
keywordBonus: keywordBonus.score
|
||||
}
|
||||
});
|
||||
console.log(`[自动投递-过滤] 通过: ${jobDesc(job)} | 总分=${finalScore.toFixed(1)}`);
|
||||
}
|
||||
|
||||
// 按评分降序排序
|
||||
scored.sort((a, b) => b.matchScore - a.matchScore);
|
||||
|
||||
console.log(`[自动投递-过滤] 结束: 原始=${jobs.length}, 通过=${scored.length}, 剔除=${jobs.length - scored.length}`);
|
||||
return scored;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user