const dayjs = require("dayjs"); const Sequelize = require('sequelize'); module.exports = (db) => { const pla_account = db.define("pla_account", { name: { comment: '账户名', type: Sequelize.STRING(50), allowNull: false, defaultValue: '' }, sn_code: { comment: '唯一标识码', type: Sequelize.STRING(50), allowNull: false, defaultValue: '' }, platform_type: { comment: '平台', type: Sequelize.STRING(50), allowNull: false, defaultValue: '' }, login_name: { comment: '登录名', type: Sequelize.STRING(50), allowNull: false, defaultValue: '' }, pwd: { comment: '密码', type: Sequelize.STRING(50), allowNull: false, defaultValue: '' }, keyword: { comment: '关键词', type: Sequelize.STRING(50), allowNull: false, defaultValue: '' }, is_enabled: { comment: '账号启用状态(1=启用,0=禁用)', type: Sequelize.TINYINT(1), allowNull: false, defaultValue: 1 }, job_type_id: { comment: '职位类型ID(关联 job_types 表)', type: Sequelize.INTEGER, allowNull: true, defaultValue: null }, //优先 排序 ,距离,薪资,工作年限 ,学历 is_salary_priority: { comment: '排序优先级', type: Sequelize.JSON(), allowNull: false, get: function () { return JSON.parse(this.getDataValue('is_salary_priority')); }, set: function (value) { 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} ] }, // 用户地址 user_address: { comment: '用户地址', type: Sequelize.STRING(200), allowNull: false, defaultValue: '' }, // 用户经度 user_longitude: { comment: '用户经度', type: Sequelize.STRING(50), allowNull: false, defaultValue: '' }, // 用户纬度 user_latitude: { comment: '用户纬度', type: Sequelize.STRING(50), allowNull: false, defaultValue: '' }, // 自动投递相关配置 auto_deliver: { comment: '自动投递开关', type: Sequelize.TINYINT(1), allowNull: false, defaultValue: 0 }, min_salary: { comment: '最低薪资(单位:元)', type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 }, max_salary: { comment: '最高薪资(单位:元)', type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 }, // 自动沟通相关配置 auto_chat: { comment: '自动沟通开关', type: Sequelize.TINYINT(1), 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 }, // 自动活跃相关配置 auto_active: { comment: '自动活跃开关', type: Sequelize.TINYINT(1), allowNull: false, defaultValue: 0 }, // 是否沟通外包岗位 is_chat_outsourcing: { comment: '是否沟通外包岗位', type: Sequelize.TINYINT(1), allowNull: false, defaultValue: 0 }, }); //pla_account.sync({ force: true }); return pla_account };