From 6523fe59a299b2f159b0793deab73271fd65f463 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 23 Feb 2023 10:01:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=B4=A2=E5=BC=95=E6=8F=90=E5=8D=87=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/mapper/system/SysLogininforMapper.xml | 4 ++-- .../main/resources/mapper/system/SysOperLogMapper.xml | 4 ++-- ruoyi-ui/src/views/monitor/logininfor/index.vue | 3 ++- ruoyi-ui/src/views/monitor/operlog/index.vue | 3 ++- sql/{ry_20230221.sql => ry_20230223.sql} | 9 +++++++-- 5 files changed, 15 insertions(+), 8 deletions(-) rename sql/{ry_20230221.sql => ry_20230223.sql} (98%) diff --git a/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml index 26d51fa3..acfc11a9 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml @@ -34,10 +34,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND user_name like concat('%', #{userName}, '%') - and date_format(login_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') + AND login_time >= #{params.beginTime} - and date_format(login_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') + AND login_time <= #{params.endTime} order by info_id desc diff --git a/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml index 647a3f72..75593c2a 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml @@ -56,10 +56,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND oper_name like concat('%', #{operName}, '%') - and date_format(oper_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') + AND oper_time >= #{params.beginTime} - and date_format(oper_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') + AND oper_time <= #{params.endTime} order by oper_id desc diff --git a/ruoyi-ui/src/views/monitor/logininfor/index.vue b/ruoyi-ui/src/views/monitor/logininfor/index.vue index 8e3dc034..d6af834c 100644 --- a/ruoyi-ui/src/views/monitor/logininfor/index.vue +++ b/ruoyi-ui/src/views/monitor/logininfor/index.vue @@ -38,11 +38,12 @@ diff --git a/ruoyi-ui/src/views/monitor/operlog/index.vue b/ruoyi-ui/src/views/monitor/operlog/index.vue index 23f1d706..34a3ce34 100644 --- a/ruoyi-ui/src/views/monitor/operlog/index.vue +++ b/ruoyi-ui/src/views/monitor/operlog/index.vue @@ -53,11 +53,12 @@ diff --git a/sql/ry_20230221.sql b/sql/ry_20230223.sql similarity index 98% rename from sql/ry_20230221.sql rename to sql/ry_20230223.sql index 123fab22..45c2ebb7 100644 --- a/sql/ry_20230221.sql +++ b/sql/ry_20230223.sql @@ -433,7 +433,10 @@ create table sys_oper_log ( error_msg varchar(2000) default '' comment '错误消息', oper_time datetime comment '操作时间', cost_time bigint(20) default 0 comment '消耗时间', - primary key (oper_id) + primary key (oper_id), + key idx_sys_oper_log_bt (business_type), + key idx_sys_oper_log_s (status), + key idx_sys_oper_log_ot (oper_time) ) engine=innodb auto_increment=100 comment = '操作日志记录'; @@ -562,7 +565,9 @@ create table sys_logininfor ( status char(1) default '0' comment '登录状态(0成功 1失败)', msg varchar(255) default '' comment '提示消息', login_time datetime comment '访问时间', - primary key (info_id) + primary key (info_id), + key idx_sys_logininfor_s (status), + key idx_sys_logininfor_lt (login_time) ) engine=innodb auto_increment=100 comment = '系统访问记录'; From 81a01a1d9d20fcc39db27572423a80c6dfc6755d Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 28 Feb 2023 13:33:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E5=87=BA=E7=8E=B0=E7=9A=84=E5=BC=82=E5=B8=B8?= =?UTF-8?q?(I6DLNU)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/plugins/download.js | 18 +++++++++--------- ruoyi-ui/src/utils/request.js | 6 +++--- ruoyi-ui/src/utils/ruoyi.js | 10 ++-------- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/ruoyi-ui/src/plugins/download.js b/ruoyi-ui/src/plugins/download.js index a3bb8c4f..ffb8c146 100644 --- a/ruoyi-ui/src/plugins/download.js +++ b/ruoyi-ui/src/plugins/download.js @@ -15,9 +15,9 @@ export default { url: url, responseType: 'blob', headers: { 'Authorization': 'Bearer ' + getToken() } - }).then(async (res) => { - const isLogin = await blobValidate(res.data); - if (isLogin) { + }).then((res) => { + const isBlob = blobValidate(res.data); + if (isBlob) { const blob = new Blob([res.data]) this.saveAs(blob, decodeURIComponent(res.headers['download-filename'])) } else { @@ -32,9 +32,9 @@ export default { url: url, responseType: 'blob', headers: { 'Authorization': 'Bearer ' + getToken() } - }).then(async (res) => { - const isLogin = await blobValidate(res.data); - if (isLogin) { + }).then((res) => { + const isBlob = blobValidate(res.data); + if (isBlob) { const blob = new Blob([res.data]) this.saveAs(blob, decodeURIComponent(res.headers['download-filename'])) } else { @@ -49,9 +49,9 @@ export default { url: url, responseType: 'blob', headers: { 'Authorization': 'Bearer ' + getToken() } - }).then(async (res) => { - const isLogin = await blobValidate(res.data); - if (isLogin) { + }).then((res) => { + const isBlob = blobValidate(res.data); + if (isBlob) { const blob = new Blob([res.data], { type: 'application/zip' }) this.saveAs(blob, name) } else { diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js index ad9923cc..8797e3f7 100644 --- a/ruoyi-ui/src/utils/request.js +++ b/ruoyi-ui/src/utils/request.js @@ -72,7 +72,7 @@ service.interceptors.response.use(res => { // 获取错误信息 const msg = errorCode[code] || res.data.msg || errorCode['default'] // 二进制数据则直接返回 - if(res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer'){ + if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') { return res.data } if (code === 401) { @@ -125,8 +125,8 @@ export function download(url, params, filename, config) { responseType: 'blob', ...config }).then(async (data) => { - const isLogin = await blobValidate(data); - if (isLogin) { + const isBlob = blobValidate(data); + if (isBlob) { const blob = new Blob([data]) saveAs(blob, filename) } else { diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js index 243c4c7b..44bf9c40 100644 --- a/ruoyi-ui/src/utils/ruoyi.js +++ b/ruoyi-ui/src/utils/ruoyi.js @@ -228,12 +228,6 @@ export function tansParams(params) { } // 验证是否为blob格式 -export async function blobValidate(data) { - try { - const text = await data.text(); - JSON.parse(text); - return false; - } catch (error) { - return true; - } +export function blobValidate(data) { + return data.type !== 'application/json' }