1
This commit is contained in:
62
api/model/chat_message.js
Normal file
62
api/model/chat_message.js
Normal file
@@ -0,0 +1,62 @@
|
||||
const Sequelize = require('sequelize');
|
||||
|
||||
/**
|
||||
* 聊天消息表
|
||||
* 每句话一条记录;会话形态(仅 data+job)用 mid=0 存一条
|
||||
*/
|
||||
module.exports = (db) => {
|
||||
const chat_message = db.define('chat_message', {
|
||||
sn_code: {
|
||||
comment: '设备SN码',
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: false,
|
||||
defaultValue: ''
|
||||
},
|
||||
platform: {
|
||||
comment: '平台: boss / liepin',
|
||||
type: Sequelize.STRING(20),
|
||||
allowNull: false,
|
||||
defaultValue: 'boss'
|
||||
},
|
||||
friendId: {
|
||||
comment: '好友/会话ID',
|
||||
type: Sequelize.BIGINT,
|
||||
allowNull: false
|
||||
},
|
||||
encryptFriendId: {
|
||||
comment: '好友加密ID',
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: true,
|
||||
defaultValue: ''
|
||||
},
|
||||
mid: {
|
||||
comment: '消息ID(接口返回)',
|
||||
type: Sequelize.BIGINT,
|
||||
allowNull: false
|
||||
},
|
||||
message_data: {
|
||||
comment: '单条消息原始数据 JSON',
|
||||
type: Sequelize.JSON,
|
||||
allowNull: true,
|
||||
defaultValue: null
|
||||
},
|
||||
fetch_time: {
|
||||
comment: '拉取时间',
|
||||
type: Sequelize.DATE,
|
||||
allowNull: true,
|
||||
defaultValue: Sequelize.NOW
|
||||
}
|
||||
}, {
|
||||
timestamps: false,
|
||||
indexes: [
|
||||
{ unique: true, fields: ['sn_code', 'platform', 'friendId', 'mid'] },
|
||||
{ unique: false, fields: ['sn_code', 'platform', 'friendId'] },
|
||||
{ unique: false, fields: ['fetch_time'] }
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
// chat_message.sync({ force: true });
|
||||
|
||||
return chat_message;
|
||||
};
|
||||
@@ -15,7 +15,7 @@ module.exports = (db) => {
|
||||
defaultValue: ''
|
||||
},
|
||||
taskType: {
|
||||
comment: '任务类型: get_login_qr_code-登录检查, get_resume-获取简历, search_jobs-搜索岗位, get_job_list-获取岗位列表, auto_deliver-自动投递, chat-聊天, apply-投递',
|
||||
comment: '任务类型: get_login_qr_code-登录检查, get_resume-获取简历, auto_search-搜索岗位, get_job_list-获取岗位列表, auto_deliver-自动投递, chat-聊天, apply-投递',
|
||||
type: Sequelize.STRING(50),
|
||||
allowNull: false,
|
||||
defaultValue: ''
|
||||
|
||||
Reference in New Issue
Block a user