新增分享码日志管理,美化界面,优化代码上传脚本
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
const { DataTypes } = require('sequelize');
|
||||
const sequelize = require('../config/database');
|
||||
|
||||
const ShareCodeLog = sequelize.define('ShareCodeLog', {
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
comment: '主键',
|
||||
},
|
||||
mac_addr: {
|
||||
type: DataTypes.STRING(17),
|
||||
allowNull: false,
|
||||
comment: '设备 MAC 地址,如 AA:BB:CC:DD:EE:FF',
|
||||
},
|
||||
share_code: {
|
||||
type: DataTypes.CHAR(5),
|
||||
allowNull: false,
|
||||
comment: '分享码(5位字符)',
|
||||
},
|
||||
action: {
|
||||
type: DataTypes.ENUM('export', 'import'),
|
||||
allowNull: false,
|
||||
comment: '操作类型:export=导出分享码,import=导入分享码',
|
||||
},
|
||||
ip_addr: {
|
||||
type: DataTypes.STRING(45),
|
||||
allowNull: false,
|
||||
defaultValue: '',
|
||||
comment: '用户 IP 地址(支持 IPv4/IPv6)',
|
||||
},
|
||||
eq_data: {
|
||||
type: DataTypes.JSON,
|
||||
allowNull: false,
|
||||
comment: 'EQ 数据快照(JSON)',
|
||||
},
|
||||
expire_at: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true,
|
||||
comment: '分享码到期时间(导出时快照,导入可为空)',
|
||||
},
|
||||
create_at: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: DataTypes.NOW,
|
||||
comment: '操作时间',
|
||||
},
|
||||
}, {
|
||||
tableName: 'share_code_log',
|
||||
comment: '分享码流水表',
|
||||
indexes: [
|
||||
{ name: 'idx_mac_addr', fields: ['mac_addr'] },
|
||||
{ name: 'idx_share_code', fields: ['share_code'] },
|
||||
{ name: 'idx_create_at', fields: ['create_at'] },
|
||||
],
|
||||
});
|
||||
|
||||
module.exports = ShareCodeLog;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const Brand = require('./Brand');
|
||||
const Model = require('./Model');
|
||||
const Ota = require('./Ota');
|
||||
const ShareCodeLog = require('./ShareCodeLog');
|
||||
|
||||
module.exports = { Brand, Model, Ota };
|
||||
module.exports = { Brand, Model, Ota, ShareCodeLog };
|
||||
|
||||
Reference in New Issue
Block a user