Files
autoAiWorkSys/api/model/feedback.js
张成 36433060f2 1
2025-12-17 14:43:13 +08:00

113 lines
2.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const Sequelize = require('sequelize');
/**
* 意见反馈表模型
* 记录用户的意见反馈信息
*/
module.exports = (db) => {
const feedback = db.define('feedback', {
// 用户信息
user_id: {
comment: '用户ID关联 pla_account.id',
type: Sequelize.INTEGER,
allowNull: false,
references: {
model: 'pla_account',
key: 'id'
}
},
sn_code: {
comment: '设备SN码',
type: Sequelize.STRING(50),
allowNull: false,
defaultValue: ''
},
// 反馈信息
type: {
comment: '反馈类型: bug-Bug反馈, suggestion-功能建议, question-使用问题, other-其他',
type: Sequelize.STRING(20),
allowNull: false,
defaultValue: 'other'
},
content: {
comment: '反馈内容',
type: Sequelize.TEXT,
allowNull: false
},
contact: {
comment: '联系方式(手机号、邮箱等)',
type: Sequelize.STRING(100),
allowNull: true,
defaultValue: ''
},
// 处理状态
status: {
comment: '处理状态: pending-待处理, processing-处理中, completed-已完成, rejected-已拒绝',
type: Sequelize.STRING(20),
allowNull: false,
defaultValue: 'pending'
},
reply_content: {
comment: '回复内容',
type: Sequelize.TEXT,
allowNull: true
},
reply_time: {
comment: '回复时间',
type: Sequelize.DATE,
allowNull: true
},
reply_user_id: {
comment: '回复人ID管理员ID',
type: Sequelize.INTEGER,
allowNull: true
},
// 备注
remark: {
comment: '备注',
type: Sequelize.TEXT,
allowNull: true
},
// 软删除
is_delete: {
comment: '是否删除0-未删除1-已删除)',
type: Sequelize.TINYINT(1),
allowNull: false,
defaultValue: 0
}
}, {
tableName: 'feedback',
indexes: [
{
name: 'idx_user_id',
fields: ['user_id']
},
{
name: 'idx_sn_code',
fields: ['sn_code']
},
{
name: 'idx_type',
fields: ['type']
},
{
name: 'idx_status',
fields: ['status']
},
{
name: 'idx_create_time',
fields: ['create_time']
}
]
});
// feedback.sync({ alter: true });
return feedback;
};