修改政府端前端,银行端小程序和后端接口

This commit is contained in:
2025-09-26 17:52:50 +08:00
parent 852adbcfff
commit 00dfa83fd1
237 changed files with 9172 additions and 33500 deletions

View File

@@ -0,0 +1,72 @@
const { DataTypes } = require('sequelize');
const sequelize = require('../config/database');
const SmartHost = sequelize.define('SmartHost', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
host_id: {
type: DataTypes.STRING,
allowNull: false,
unique: true,
comment: '主机编号'
},
name: {
type: DataTypes.STRING,
allowNull: false,
comment: '主机名称'
},
ip_address: {
type: DataTypes.STRING,
allowNull: false,
comment: 'IP地址'
},
status: {
type: DataTypes.ENUM('active', 'inactive', 'maintenance'),
allowNull: false,
defaultValue: 'inactive',
comment: '状态active-使用中inactive-未使用maintenance-维护中'
},
remark: {
type: DataTypes.TEXT,
allowNull: true,
comment: '备注'
},
created_at: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
comment: '创建时间'
},
updated_at: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
comment: '更新时间'
}
}, {
tableName: 'smart_hosts',
timestamps: true,
createdAt: 'created_at',
updatedAt: 'updated_at',
paranoid: false,
indexes: [
{
name: 'idx_smart_host_id',
fields: ['host_id']
},
{
name: 'idx_smart_host_status',
fields: ['status']
}
]
});
// 钩子函数,在保存前更新更新时间
SmartHost.beforeSave((host) => {
host.updated_at = new Date();
});
module.exports = SmartHost;