refactor: 移除登录历史和操作日志功能及相关代码
移除后端登录历史和操作日志的模型、路由及前端相关页面和路由配置 清理创建和删除索引脚本中的相关代码 调整系统管理菜单结构
This commit is contained in:
@@ -1,63 +0,0 @@
|
||||
const { DataTypes } = require('sequelize');
|
||||
const { sequelize } = require('../db');
|
||||
|
||||
const LoginHistory = sequelize.define('LoginHistory', {
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true
|
||||
},
|
||||
userId: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
comment: '用户ID'
|
||||
},
|
||||
username: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
comment: '用户名'
|
||||
},
|
||||
realName: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
comment: '真实姓名'
|
||||
},
|
||||
loginTime: {
|
||||
type: DataTypes.DATE,
|
||||
defaultValue: DataTypes.NOW,
|
||||
comment: '登录时间'
|
||||
},
|
||||
loginIp: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
comment: '登录IP'
|
||||
},
|
||||
userAgent: {
|
||||
type: DataTypes.TEXT,
|
||||
allowNull: true,
|
||||
comment: '浏览器UA'
|
||||
},
|
||||
loginType: {
|
||||
type: DataTypes.ENUM('success', 'failed'),
|
||||
defaultValue: 'success',
|
||||
comment: '登录结果'
|
||||
},
|
||||
failReason: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
comment: '失败原因'
|
||||
}
|
||||
}, {
|
||||
tableName: 'login_histories',
|
||||
timestamps: true,
|
||||
createdAt: 'loginTime',
|
||||
updatedAt: false,
|
||||
indexes: [
|
||||
{ fields: ['userId'] },
|
||||
{ fields: ['loginTime'] },
|
||||
{ fields: ['loginType'] },
|
||||
{ fields: ['userId', 'loginTime'] }
|
||||
]
|
||||
});
|
||||
|
||||
module.exports = LoginHistory;
|
||||
@@ -1,89 +0,0 @@
|
||||
const { DataTypes } = require('sequelize');
|
||||
const { sequelize } = require('../db');
|
||||
|
||||
const OperationLog = sequelize.define('OperationLog', {
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true
|
||||
},
|
||||
userId: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
comment: '操作人ID'
|
||||
},
|
||||
username: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
comment: '操作人用户名'
|
||||
},
|
||||
realName: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
comment: '操作人真实姓名'
|
||||
},
|
||||
action: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
comment: '操作类型'
|
||||
},
|
||||
module: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
comment: '操作模块'
|
||||
},
|
||||
description: {
|
||||
type: DataTypes.TEXT,
|
||||
allowNull: true,
|
||||
comment: '操作描述'
|
||||
},
|
||||
targetId: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
comment: '目标对象ID'
|
||||
},
|
||||
targetName: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
comment: '目标对象名称'
|
||||
},
|
||||
oldValue: {
|
||||
type: DataTypes.TEXT,
|
||||
allowNull: true,
|
||||
comment: '旧值'
|
||||
},
|
||||
newValue: {
|
||||
type: DataTypes.TEXT,
|
||||
allowNull: true,
|
||||
comment: '新值'
|
||||
},
|
||||
ip: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
comment: '操作IP'
|
||||
},
|
||||
status: {
|
||||
type: DataTypes.ENUM('success', 'failed'),
|
||||
defaultValue: 'success',
|
||||
comment: '操作状态'
|
||||
},
|
||||
errorMessage: {
|
||||
type: DataTypes.TEXT,
|
||||
allowNull: true,
|
||||
comment: '错误信息'
|
||||
}
|
||||
}, {
|
||||
tableName: 'operation_logs',
|
||||
timestamps: true,
|
||||
createdAt: 'operateTime',
|
||||
updatedAt: false,
|
||||
indexes: [
|
||||
{ fields: ['userId'] },
|
||||
{ fields: ['action'] },
|
||||
{ fields: ['module'] },
|
||||
{ fields: ['operateTime'] },
|
||||
{ fields: ['userId', 'operateTime'] }
|
||||
]
|
||||
});
|
||||
|
||||
module.exports = OperationLog;
|
||||
Reference in New Issue
Block a user