11
This commit is contained in:
@@ -350,7 +350,11 @@ class JobManager {
|
||||
if (notPassedIds.length > 0) {
|
||||
try {
|
||||
await job_postings.update(
|
||||
{ applyStatus: 'filtered' },
|
||||
{
|
||||
applyStatus: 'filtered',
|
||||
is_delivered: false,
|
||||
deliver_failed_reason: '未通过搜索并投递筛选规则'
|
||||
},
|
||||
{
|
||||
where: {
|
||||
id: { [Op.in]: notPassedIds },
|
||||
@@ -650,6 +654,13 @@ class JobManager {
|
||||
// 检查是否已存在投递记录(避免重复投递同一职位)
|
||||
const existingApply = await apply_records.findOne({ where: { sn_code, jobId: jobData.jobId } });
|
||||
if (existingApply) {
|
||||
await job_postings.update(
|
||||
{
|
||||
is_delivered: false,
|
||||
deliver_failed_reason: '该岗位已投递过'
|
||||
},
|
||||
{ where: { id: jobData.id } }
|
||||
);
|
||||
console.log(`[工作管理] 跳过已投递职位: ${jobData.jobTitle} @ ${jobData.companyName}`);
|
||||
return {
|
||||
success: false,
|
||||
@@ -684,6 +695,14 @@ class JobManager {
|
||||
|
||||
if (recentCompanyApply) {
|
||||
const daysAgo = Math.floor((new Date() - new Date(recentCompanyApply.applyTime)) / (1000 * 60 * 60 * 24));
|
||||
const skip_reason = `该公司在${daysAgo}天前已投递过,30天内不重复投递`;
|
||||
await job_postings.update(
|
||||
{
|
||||
is_delivered: false,
|
||||
deliver_failed_reason: skip_reason
|
||||
},
|
||||
{ where: { id: jobData.id } }
|
||||
);
|
||||
console.log(`[工作管理] 跳过30天内已投递的公司: ${jobData.companyName} (${daysAgo}天前投递过)`);
|
||||
return {
|
||||
success: false,
|
||||
@@ -716,7 +735,12 @@ class JobManager {
|
||||
if (response && response.code === 200) {
|
||||
// 投递成功
|
||||
await job_postings.update(
|
||||
{ applyStatus: 'applied', applyTime: new Date() },
|
||||
{
|
||||
applyStatus: 'applied',
|
||||
applyTime: new Date(),
|
||||
is_delivered: true,
|
||||
deliver_failed_reason: ''
|
||||
},
|
||||
{ where: { id: jobData.id } }
|
||||
);
|
||||
|
||||
@@ -795,8 +819,13 @@ class JobManager {
|
||||
};
|
||||
} else {
|
||||
// 投递失败
|
||||
const fail_msg = String(response?.message || response?.msg || '投递失败').slice(0, 65000);
|
||||
await job_postings.update(
|
||||
{ applyStatus: 'failed' },
|
||||
{
|
||||
applyStatus: 'failed',
|
||||
is_delivered: false,
|
||||
deliver_failed_reason: fail_msg
|
||||
},
|
||||
{ where: { id: jobData.id } }
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user