This commit is contained in:
张成
2026-04-03 17:24:38 +08:00
parent 39a5b49213
commit 820e437729

View File

@@ -725,9 +725,9 @@ class JobManager {
}; };
} }
// 检查该公司是否在一个月内已投递过(避免连续投递同一公司 // 检查该公司是否在 30 天内已投递过(超过 30 天可再投该公司其它岗位
const oneMonthAgo = new Date(); const thirtyDaysAgo = new Date();
oneMonthAgo.setMonth(oneMonthAgo.getMonth() - 1); thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);
const Sequelize = require('sequelize'); const Sequelize = require('sequelize');
const recentCompanyApply = await apply_records.findOne({ const recentCompanyApply = await apply_records.findOne({
@@ -735,7 +735,7 @@ class JobManager {
sn_code: sn_code, sn_code: sn_code,
companyName: jobData.companyName, companyName: jobData.companyName,
applyTime: { applyTime: {
[Sequelize.Op.gte]: oneMonthAgo [Sequelize.Op.gte]: thirtyDaysAgo
} }
}, },
order: [['applyTime', 'DESC']] order: [['applyTime', 'DESC']]
@@ -743,18 +743,18 @@ class JobManager {
if (recentCompanyApply) { if (recentCompanyApply) {
const daysAgo = Math.floor((new Date() - new Date(recentCompanyApply.applyTime)) / (1000 * 60 * 60 * 24)); const daysAgo = Math.floor((new Date() - new Date(recentCompanyApply.applyTime)) / (1000 * 60 * 60 * 24));
console.log(`[工作管理] 跳过一个月内已投递的公司: ${jobData.companyName} (${daysAgo}天前投递过)`); console.log(`[工作管理] 跳过30天内已投递的公司: ${jobData.companyName} (${daysAgo}天前投递过)`);
return { return {
success: false, success: false,
deliveredCount: 0, deliveredCount: 0,
failedCount: 1, failedCount: 1,
message: `该公司在${daysAgo}天前已投递过,一个月内不重复投递`, message: `该公司在${daysAgo}天前已投递过,30天内不重复投递`,
deliveredJobs: [], deliveredJobs: [],
failedJobs: [{ failedJobs: [{
jobId: jobData.jobId, jobId: jobData.jobId,
jobTitle: jobData.jobTitle, jobTitle: jobData.jobTitle,
companyName: jobData.companyName, companyName: jobData.companyName,
error: `该公司在${daysAgo}天前已投递过,一个月内不重复投递` error: `该公司在${daysAgo}天前已投递过,30天内不重复投递`
}] }]
}; };
} }