1
This commit is contained in:
@@ -59,12 +59,31 @@ module.exports = (db) => {
|
||||
type: Sequelize.JSON(),
|
||||
allowNull: false,
|
||||
get: function () {
|
||||
return JSON.parse(this.getDataValue('is_salary_priority'));
|
||||
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}];
|
||||
}
|
||||
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 value;
|
||||
},
|
||||
set: function (value) {
|
||||
this.setDataValue('is_salary_priority', JSON.stringify(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}]));
|
||||
} else if (typeof value === 'string') {
|
||||
// 如果已经是字符串,直接使用
|
||||
this.setDataValue('is_salary_priority', value);
|
||||
} else {
|
||||
// 如果是对象/数组,序列化为字符串
|
||||
this.setDataValue('is_salary_priority', JSON.stringify(value));
|
||||
}
|
||||
},
|
||||
defaultValue: [ { "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}])
|
||||
},
|
||||
|
||||
|
||||
@@ -97,17 +116,56 @@ module.exports = (db) => {
|
||||
allowNull: false,
|
||||
defaultValue: 0
|
||||
},
|
||||
min_salary: {
|
||||
comment: '最低薪资(单位:元)',
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 0
|
||||
},
|
||||
max_salary: {
|
||||
comment: '最高薪资(单位:元)',
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 0
|
||||
// 自动投递配置(JSON格式,包含:deliver_interval-投递间隔分钟数, min_salary-最低薪资, max_salary-最高薪资, page_count-滚动获取职位列表次数, max_deliver-每次最多投递数量, filter_keywords-过滤关键词, exclude_keywords-排除关键词)
|
||||
deliver_config: {
|
||||
comment: '自动投递配置(JSON对象)',
|
||||
type: Sequelize.JSON(),
|
||||
allowNull: true,
|
||||
get: function () {
|
||||
const value = this.getDataValue('deliver_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('deliver_config', null);
|
||||
} else if (typeof value === 'string') {
|
||||
// 如果已经是字符串,直接使用
|
||||
this.setDataValue('deliver_config', value);
|
||||
} else {
|
||||
// 如果是对象,序列化为字符串
|
||||
this.setDataValue('deliver_config', JSON.stringify(value));
|
||||
}
|
||||
},
|
||||
// 默认值说明:
|
||||
// deliver_interval: 30 - 投递间隔时间,单位:分钟,默认30分钟执行一次自动投递
|
||||
// min_salary: 0 - 最低薪资(单位:元),0表示不限制
|
||||
// max_salary: 0 - 最高薪资(单位:元),0表示不限制
|
||||
// page_count: 3 - 滚动获取职位列表次数,默认3次
|
||||
// max_deliver: 10 - 每次最多投递数量,默认10个
|
||||
// filter_keywords: [] - 过滤关键词数组,包含这些关键词的职位会被优先考虑
|
||||
// exclude_keywords: [] - 排除关键词数组,包含这些关键词的职位会被排除
|
||||
defaultValue: JSON.stringify({
|
||||
deliver_interval: 30,
|
||||
min_salary: 0,
|
||||
max_salary: 0,
|
||||
page_count: 3,
|
||||
max_deliver: 10,
|
||||
time_range: {
|
||||
start_time: '09:00',
|
||||
end_time: '18:00',
|
||||
workdays_only: 1
|
||||
},
|
||||
filter_keywords: [],
|
||||
exclude_keywords: []
|
||||
})
|
||||
},
|
||||
// 自动沟通相关配置
|
||||
auto_chat: {
|
||||
@@ -116,18 +174,52 @@ module.exports = (db) => {
|
||||
allowNull: false,
|
||||
defaultValue: 0
|
||||
},
|
||||
chat_interval: {
|
||||
comment: '沟通间隔(单位:分钟)',
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 30
|
||||
},
|
||||
auto_reply: {
|
||||
comment: '自动回复开关',
|
||||
type: Sequelize.TINYINT(1),
|
||||
allowNull: false,
|
||||
defaultValue: 0
|
||||
// 自动沟通配置(JSON格式,包含:chat_interval-沟通间隔分钟数, is_chat_outsourcing-是否沟通外包岗位, time_range-沟通时间段)
|
||||
chat_strategy: {
|
||||
comment: '自动沟通策略配置(JSON对象)',
|
||||
type: Sequelize.JSON(),
|
||||
allowNull: true,
|
||||
get: function () {
|
||||
const value = this.getDataValue('chat_strategy');
|
||||
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('chat_strategy', null);
|
||||
} else if (typeof value === 'string') {
|
||||
// 如果已经是字符串,直接使用
|
||||
this.setDataValue('chat_strategy', value);
|
||||
} else {
|
||||
// 如果是对象,序列化为字符串
|
||||
this.setDataValue('chat_strategy', JSON.stringify(value));
|
||||
}
|
||||
},
|
||||
// 默认值说明:
|
||||
// chat_interval: 30 - 沟通间隔时间,单位:分钟,默认30分钟执行一次自动沟通
|
||||
// is_chat_outsourcing: 0 - 是否沟通外包岗位,0=不沟通外包岗位,1=沟通外包岗位
|
||||
// time_range: 沟通时间段配置
|
||||
// - start_time: 开始时间,格式:HH:mm,默认 "09:00"
|
||||
// - end_time: 结束时间,格式:HH:mm,默认 "18:00"
|
||||
// - workdays_only: 是否仅工作日,0=包含周末,1=仅工作日,默认1
|
||||
defaultValue: JSON.stringify({
|
||||
chat_interval: 30,
|
||||
is_chat_outsourcing: 0,
|
||||
time_range: {
|
||||
start_time: '09:00',
|
||||
end_time: '18:00',
|
||||
workdays_only: 1
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 自动活跃相关配置
|
||||
auto_active: {
|
||||
comment: '自动活跃开关',
|
||||
@@ -135,18 +227,47 @@ module.exports = (db) => {
|
||||
allowNull: false,
|
||||
defaultValue: 0
|
||||
},
|
||||
// 是否沟通外包岗位
|
||||
is_chat_outsourcing: {
|
||||
comment: '是否沟通外包岗位',
|
||||
type: Sequelize.TINYINT(1),
|
||||
allowNull: false,
|
||||
defaultValue: 0
|
||||
// 自动活跃配置(JSON格式,包含:active_interval-活跃间隔分钟数, actions-活跃动作列表)
|
||||
active_actions: {
|
||||
comment: '自动活跃动作配置(JSON对象)',
|
||||
type: Sequelize.JSON(),
|
||||
allowNull: true,
|
||||
get: function () {
|
||||
const value = this.getDataValue('active_actions');
|
||||
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('active_actions', null);
|
||||
} else if (typeof value === 'string') {
|
||||
// 如果已经是字符串,直接使用
|
||||
this.setDataValue('active_actions', value);
|
||||
} else {
|
||||
// 如果是对象,序列化为字符串
|
||||
this.setDataValue('active_actions', JSON.stringify(value));
|
||||
}
|
||||
},
|
||||
// 默认值说明:
|
||||
// active_interval: 60 - 活跃间隔时间,单位:分钟,默认60分钟执行一次活跃动作
|
||||
// actions: [] - 活跃动作列表,数组格式,可包含多个活跃动作配置对象
|
||||
defaultValue: JSON.stringify({
|
||||
active_interval: 60,
|
||||
actions: []
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
});
|
||||
|
||||
//pla_account.sync({ force: true });
|
||||
// pla_account.sync({ force: true });
|
||||
return pla_account
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user