1
This commit is contained in:
@@ -426,7 +426,7 @@ class JobManager {
|
||||
*/
|
||||
async get_job_list(sn_code, mqttClient, params = {}) {
|
||||
const {
|
||||
keyword = '前端',
|
||||
keyword: paramKeyword = '',
|
||||
platform = 'boss',
|
||||
pageCount = 3,
|
||||
city = '',
|
||||
@@ -438,22 +438,60 @@ class JobManager {
|
||||
companySize = '',
|
||||
financingStage = '',
|
||||
page = 1,
|
||||
pageSize = 20
|
||||
pageSize = 20,
|
||||
tabLabel,
|
||||
tabIndex,
|
||||
job_type_id
|
||||
} = params;
|
||||
|
||||
// 判断是否是多条件搜索(如果包含多条件参数,使用多条件搜索逻辑)
|
||||
const hasMultiParams = city || cityName || salary || experience || education ||
|
||||
industry || companySize || financingStage || page || pageSize;
|
||||
// 推荐列表实际按期望 tab 拉取,入库 keyword 应与「职位来源」一致:显式 keyword > deliver_tab_label > 空(不再默认「前端」)
|
||||
let keyword = paramKeyword != null && String(paramKeyword).trim() !== ''
|
||||
? String(paramKeyword).trim()
|
||||
: '';
|
||||
if (!keyword && tabLabel != null && String(tabLabel).trim() !== '') {
|
||||
keyword = String(tabLabel).trim();
|
||||
}
|
||||
|
||||
// 仅当调用方显式传入筛选/分页字段时才走多条件分支(避免 page/pageSize 默认值把简单拉列表永远判成「多条件」)
|
||||
const hasMultiParams = Boolean(
|
||||
(params.city != null && params.city !== '') ||
|
||||
(params.cityName != null && params.cityName !== '') ||
|
||||
(params.salary != null && params.salary !== '') ||
|
||||
(params.experience != null && params.experience !== '') ||
|
||||
(params.education != null && params.education !== '') ||
|
||||
(params.industry != null && params.industry !== '') ||
|
||||
(params.companySize != null && params.companySize !== '') ||
|
||||
(params.financingStage != null && params.financingStage !== '') ||
|
||||
params.page !== undefined ||
|
||||
params.pageSize !== undefined
|
||||
);
|
||||
|
||||
/** 期望 tab 与职位类型需原样带给设备端 get_job_list,否则不会切换 .c-expect-select 标签 */
|
||||
const appendExpectTabToData = (data) => {
|
||||
if (tabLabel != null && String(tabLabel).trim() !== '') {
|
||||
data.tabLabel = String(tabLabel).trim();
|
||||
}
|
||||
if (tabIndex !== undefined && tabIndex !== null && String(tabIndex).trim() !== '') {
|
||||
const ti = Number(tabIndex);
|
||||
if (!Number.isNaN(ti)) {
|
||||
data.tabIndex = ti;
|
||||
}
|
||||
}
|
||||
if (job_type_id != null && job_type_id !== '') {
|
||||
data.job_type_id = job_type_id;
|
||||
}
|
||||
return data;
|
||||
};
|
||||
|
||||
if (hasMultiParams) {
|
||||
// 使用多条件搜索逻辑
|
||||
console.log(`[工作管理] 开始多条件搜索设备 ${sn_code} 的职位,关键词: ${keyword}, 城市: ${cityName || city}`);
|
||||
|
||||
// 构建完整的搜索参数对象
|
||||
const searchData = {
|
||||
const searchData = appendExpectTabToData({
|
||||
keyword,
|
||||
pageCount
|
||||
};
|
||||
});
|
||||
|
||||
// 添加可选搜索条件
|
||||
if (city) searchData.city = city;
|
||||
@@ -513,11 +551,11 @@ class JobManager {
|
||||
// 简单搜索逻辑(保持原有逻辑)
|
||||
console.log(`[工作管理] 开始获取设备 ${sn_code} 的岗位列表,关键词: ${keyword}`);
|
||||
|
||||
// 通过MQTT指令获取岗位列表
|
||||
// 通过MQTT指令获取岗位列表(须带上 tabLabel/tabIndex,与 schedule/deliver 下发一致)
|
||||
const response = await mqttClient.publishAndWait(sn_code, {
|
||||
platform,
|
||||
action: "get_job_list",
|
||||
data: { keyword, pageCount }
|
||||
data: appendExpectTabToData({ keyword, pageCount })
|
||||
});
|
||||
|
||||
if (!response || response.code !== 200) {
|
||||
|
||||
@@ -91,7 +91,15 @@ class DeliverHandler extends BaseHandler {
|
||||
|
||||
// 6. 下发 get_job_list 拉取职位列表(tabLabel 切换期望 tab,job_type_id 随指令下发供设备使用)
|
||||
const tabLabel = resume.deliver_tab_label || '';
|
||||
await this.getJobList(sn_code, platform, pageCount, task.id, tabLabel, accountConfig.job_type_id);
|
||||
await this.getJobList(
|
||||
sn_code,
|
||||
platform,
|
||||
pageCount,
|
||||
task.id,
|
||||
tabLabel,
|
||||
accountConfig.job_type_id,
|
||||
accountConfig.keyword
|
||||
);
|
||||
|
||||
// 7. 从数据库获取待投递职位
|
||||
const pendingJobs = await this.getPendingJobs(sn_code, platform, actualMaxCount * 3);
|
||||
@@ -277,14 +285,20 @@ class DeliverHandler extends BaseHandler {
|
||||
* @param {string} tabLabel - 投递用期望标签文案,对应 resume_info.deliver_tab_label,get_job_list 会按此选择 tab
|
||||
* @param {number} jobTypeId - 职位类型 ID,随指令下发供设备使用
|
||||
*/
|
||||
async getJobList(sn_code, platform, pageCount, taskId, tabLabel = '', jobTypeId = null) {
|
||||
async getJobList(sn_code, platform, pageCount, taskId, tabLabel = '', jobTypeId = null, accountKeyword = '') {
|
||||
const label = tabLabel != null && String(tabLabel).trim() !== '' ? String(tabLabel).trim() : '';
|
||||
const accKw = accountKeyword != null && String(accountKeyword).trim() !== '' ? String(accountKeyword).trim() : '';
|
||||
// 与 jobManager 一致:优先期望职位文案,其次账户搜索词,用于 job_postings.keyword
|
||||
const keyword = label || accKw;
|
||||
|
||||
const params = {
|
||||
sn_code,
|
||||
platform,
|
||||
pageCount
|
||||
pageCount,
|
||||
keyword
|
||||
};
|
||||
if (tabLabel != null && String(tabLabel).trim() !== '') {
|
||||
params.tabLabel = String(tabLabel).trim();
|
||||
if (label) {
|
||||
params.tabLabel = label;
|
||||
}
|
||||
if (jobTypeId != null && jobTypeId !== '') {
|
||||
params.job_type_id = jobTypeId;
|
||||
|
||||
@@ -77,9 +77,14 @@ class SearchHandler extends BaseHandler {
|
||||
console.warn('[自动搜索] 读取 resume_info.deliver_tab_label 失败:', e.message);
|
||||
}
|
||||
|
||||
let listKeyword = (keyword && String(keyword).trim()) || (accountConfig.keyword && String(accountConfig.keyword).trim()) || '';
|
||||
if (!listKeyword && tabLabel) {
|
||||
listKeyword = tabLabel;
|
||||
}
|
||||
|
||||
const commandParams = {
|
||||
sn_code,
|
||||
keyword: keyword || accountConfig.keyword || '',
|
||||
keyword: listKeyword,
|
||||
platform: platformType,
|
||||
pageCount: pageCount || searchConfig.page_count || 3
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user