This commit is contained in:
张成
2026-02-28 15:21:59 +08:00
parent e44ffba1ef
commit 96da90daa8

View File

@@ -504,6 +504,52 @@ module.exports = {
}
},
/**
* 仅保存投递标签:标签列表(来自 get_job_listings+ 当前选中的标签
* 只更新 resume_info 的 job_listings、deliver_tab_label不碰其他配置
*/
'POST /user/deliver-tab-label/save': async (ctx) => {
try {
const body = ctx.getBody();
const { sn_code, job_listings, deliver_tab_label } = body;
if (!sn_code) return ctx.fail('请提供设备SN码');
const { pla_account, resume_info } = await Framework.getModels();
const user = await pla_account.findOne({ where: { sn_code } });
if (!user) return ctx.fail('用户不存在');
const platform = user.platform_type || 'boss';
const account_id = user.account_id != null ? String(user.account_id) : (user.id != null ? String(user.id) : '');
const list = Array.isArray(job_listings) ? job_listings : [];
const label = deliver_tab_label != null ? String(deliver_tab_label) : '';
let resume = await resume_info.findOne({
where: { sn_code, platform },
order: [['last_modify_time', 'DESC']]
});
if (resume) {
await resume_info.update(
{ job_listings: list, deliver_tab_label: label },
{ where: { id: resume.id } }
);
} else {
await resume_info.create({
sn_code,
account_id: account_id || '',
platform,
resumeId: '',
job_listings: list,
deliver_tab_label: label,
isActive: true
});
}
return ctx.success({ message: '投递标签已保存', job_listings: list, deliver_tab_label: label });
} catch (error) {
console.error('[保存投递标签失败]', error);
return ctx.fail('保存投递标签失败');
}
},
/**
* 保存账号功能配置可只传需要更新的部分deliver_config / chat_strategy / active_actions
*/