From 52876229a8a2982fd06120b74f60f6b53a89bfb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=88=90?= Date: Tue, 30 Dec 2025 17:06:14 +0800 Subject: [PATCH] 1 --- _script/sync_all_models.js | 1 - api/middleware/mqtt/mqttClient.js | 5 --- api/model/pla_account.js | 61 ++++++++++++++++++++++++++++--- 3 files changed, 56 insertions(+), 11 deletions(-) diff --git a/_script/sync_all_models.js b/_script/sync_all_models.js index 0c4adfd..0596a87 100644 --- a/_script/sync_all_models.js +++ b/_script/sync_all_models.js @@ -34,7 +34,6 @@ async function syncAllModels() { // 执行同步 await model.sync({ alter: true }); - console.log(`✅ ${modelName} 同步完成`); return { modelName, success: true }; } catch (error) { diff --git a/api/middleware/mqtt/mqttClient.js b/api/middleware/mqtt/mqttClient.js index 2d04cac..2dbb044 100644 --- a/api/middleware/mqtt/mqttClient.js +++ b/api/middleware/mqtt/mqttClient.js @@ -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) { diff --git a/api/model/pla_account.js b/api/model/pla_account.js index e55ba45..9975644 100644 --- a/api/model/pla_account.js +++ b/api/model/pla_account.js @@ -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: '自动活跃开关',