1
This commit is contained in:
@@ -29,12 +29,7 @@ class MqttSyncClient {
|
||||
return;
|
||||
}
|
||||
|
||||
// 记录日志但不包含敏感信息
|
||||
const { maskSensitiveData } = require('../../utils/crypto_utils');
|
||||
const safeMessage = maskSensitiveData(messageObj, ['password', 'pwd', 'token', 'secret', 'key', 'cookie']);
|
||||
console.log('[MQTT] 收到消息', topic, '类型:', messageObj.action || messageObj.type || 'unknown');
|
||||
|
||||
// 优化:只通知相关 topic 的监听器,而不是所有监听器
|
||||
// 1. 触发该 topic 的专用监听器
|
||||
const topicListeners = this.messageListeners.get(topic);
|
||||
if (topicListeners && topicListeners.size > 0) {
|
||||
|
||||
@@ -79,20 +79,20 @@ module.exports = (db) => {
|
||||
get: function () {
|
||||
const value = this.getDataValue('is_salary_priority');
|
||||
if (!value) {
|
||||
return [{ "key": "distance", "weight": 50 }, { "key": "salary", "weight": 20 }, { "key": "work_years", "weight": 10 }, { "key": "education", "weight": 20}];
|
||||
return [{ "key": "distance", "weight": 50 }, { "key": "salary", "weight": 20 }, { "key": "work_years", "weight": 10 }, { "key": "education", "weight": 20 }];
|
||||
}
|
||||
if (typeof value === 'string') {
|
||||
try {
|
||||
return JSON.parse(value);
|
||||
} catch (e) {
|
||||
return [{ "key": "distance", "weight": 50 }, { "key": "salary", "weight": 20 }, { "key": "work_years", "weight": 10 }, { "key": "education", "weight": 20}];
|
||||
return [{ "key": "distance", "weight": 50 }, { "key": "salary", "weight": 20 }, { "key": "work_years", "weight": 10 }, { "key": "education", "weight": 20 }];
|
||||
}
|
||||
}
|
||||
return value;
|
||||
},
|
||||
set: function (value) {
|
||||
if (value === null || value === undefined) {
|
||||
this.setDataValue('is_salary_priority', JSON.stringify([{ "key": "distance", "weight": 50 }, { "key": "salary", "weight": 20 }, { "key": "work_years", "weight": 10 }, { "key": "education", "weight": 20}]));
|
||||
this.setDataValue('is_salary_priority', JSON.stringify([{ "key": "distance", "weight": 50 }, { "key": "salary", "weight": 20 }, { "key": "work_years", "weight": 10 }, { "key": "education", "weight": 20 }]));
|
||||
} else if (typeof value === 'string') {
|
||||
// 如果已经是字符串,直接使用
|
||||
this.setDataValue('is_salary_priority', value);
|
||||
@@ -101,7 +101,7 @@ module.exports = (db) => {
|
||||
this.setDataValue('is_salary_priority', JSON.stringify(value));
|
||||
}
|
||||
},
|
||||
defaultValue: JSON.stringify([{ "key": "distance", "weight": 50 }, { "key": "salary", "weight": 20 }, { "key": "work_years", "weight": 10 }, { "key": "education", "weight": 20}])
|
||||
defaultValue: JSON.stringify([{ "key": "distance", "weight": 50 }, { "key": "salary", "weight": 20 }, { "key": "work_years", "weight": 10 }, { "key": "education", "weight": 20 }])
|
||||
},
|
||||
|
||||
|
||||
@@ -185,6 +185,57 @@ module.exports = (db) => {
|
||||
exclude_keywords: []
|
||||
})
|
||||
},
|
||||
// 自动搜索相关配置
|
||||
auto_search: {
|
||||
comment: '自动搜索开关',
|
||||
type: Sequelize.TINYINT(1),
|
||||
allowNull: false,
|
||||
defaultValue: 0
|
||||
},
|
||||
// 自动搜索配置(JSON格式,包含:search_interval-搜索间隔分钟数, page_count-滚动获取职位列表次数, city-城市, time_range-搜索时间段)
|
||||
search_config: {
|
||||
comment: '自动搜索配置(JSON对象)',
|
||||
type: Sequelize.JSON(),
|
||||
allowNull: true,
|
||||
get: function () {
|
||||
const value = this.getDataValue('search_config');
|
||||
if (!value) return null;
|
||||
if (typeof value === 'string') {
|
||||
try {
|
||||
return JSON.parse(value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
},
|
||||
set: function (value) {
|
||||
if (value === null || value === undefined) {
|
||||
this.setDataValue('search_config', null);
|
||||
} else if (typeof value === 'string') {
|
||||
// 如果已经是字符串,直接使用
|
||||
this.setDataValue('search_config', value);
|
||||
} else {
|
||||
// 如果是对象,序列化为字符串
|
||||
this.setDataValue('search_config', JSON.stringify(value));
|
||||
}
|
||||
},
|
||||
// 默认值说明:
|
||||
// city: '' - 城市,默认空字符串
|
||||
// cityName: '' - 城市名称,默认空字符串
|
||||
// salary: '' - 薪资,默认空字符串
|
||||
// experience: '' - 经验,默认空字符串
|
||||
// education: '' - 学历,默认空字符串
|
||||
|
||||
defaultValue: JSON.stringify({
|
||||
search_interval: 30,
|
||||
city: '',
|
||||
cityName: '',
|
||||
salary: '',
|
||||
experience: '',
|
||||
education: ''
|
||||
})
|
||||
},
|
||||
// 自动沟通相关配置
|
||||
auto_chat: {
|
||||
comment: '自动沟通开关',
|
||||
@@ -237,7 +288,7 @@ module.exports = (db) => {
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
// 自动活跃相关配置
|
||||
auto_active: {
|
||||
comment: '自动活跃开关',
|
||||
|
||||
Reference in New Issue
Block a user