From dbdf918fe91513b93c18c2523bf8639b26603c14 Mon Sep 17 00:00:00 2001 From: xjs <1294405880@qq.com> Date: Sat, 8 Jan 2022 13:35:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=B4=E6=98=8E=EF=BC=9A1=E3=80=81apilog?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=E5=88=87=E9=9D=A2=E7=BB=86=E8=8A=82=E8=B0=83?= =?UTF-8?q?=E6=95=B4=20=20=20=20=20=202=E3=80=81apilog=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=BB=86=E8=8A=82=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/openapi/copywriting/index.vue | 2 +- .../src/views/business/openapi/log/index.vue | 17 +++++++++++++++-- .../java/com/xjs/common/aop/ApiLogAspect.java | 12 +++++++++--- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/ruoyi-ui/src/views/business/openapi/copywriting/index.vue b/ruoyi-ui/src/views/business/openapi/copywriting/index.vue index f800ef4b..f77c19cd 100644 --- a/ruoyi-ui/src/views/business/openapi/copywriting/index.vue +++ b/ruoyi-ui/src/views/business/openapi/copywriting/index.vue @@ -171,7 +171,7 @@ export default { // 查询参数 queryParams: { pageNum: 1, - pageSize: 10, + pageSize: 30, content: null, source: null, createTime: null, diff --git a/ruoyi-ui/src/views/business/openapi/log/index.vue b/ruoyi-ui/src/views/business/openapi/log/index.vue index abc73728..a63f70c5 100644 --- a/ruoyi-ui/src/views/business/openapi/log/index.vue +++ b/ruoyi-ui/src/views/business/openapi/log/index.vue @@ -190,6 +190,8 @@ export default { isSuccess: null, createTime: null }; + this.request=null + this.response=null this.resetForm("form"); }, /** 搜索按钮操作 */ @@ -201,8 +203,19 @@ export default { handleView(row) { this.open = true; this.form = row; - this.request = eval('(' + this.form.request + ')'); - this.response=JSON.parse(this.form.response) + try { + this.request = JSON.parse(this.form.request) + this.response=JSON.parse(this.form.response) + } catch(err) { + this.open = false; + this.$notify({ + title: '警告', + message: '参数不是json格式!!!', + type: 'warning' + }); + + } + }, /** 重置按钮操作 */ resetQuery() { diff --git a/xjs-business/xjs-business-openapi/src/main/java/com/xjs/common/aop/ApiLogAspect.java b/xjs-business/xjs-business-openapi/src/main/java/com/xjs/common/aop/ApiLogAspect.java index 0e8d0c2b..fc728cef 100644 --- a/xjs-business/xjs-business-openapi/src/main/java/com/xjs/common/aop/ApiLogAspect.java +++ b/xjs-business/xjs-business-openapi/src/main/java/com/xjs/common/aop/ApiLogAspect.java @@ -105,10 +105,16 @@ public class ApiLogAspect { entity.setUrl(url); Object[] args = joinPoint.getArgs();//请求体 StringBuilder builder = new StringBuilder(); - for (Object arg : args) { - String json = JSON.toJSONString(arg); - builder.append(json); + for (int i = 0; i < args.length; i++) { + String json = JSON.toJSONString(args[i]); + //判断最后一位 + if (i == args.length - 1) { + builder.append(json); + }else { + builder.append(json + ","); + } } + entity.setMethod(apiLog.method()); entity.setRequest(builder.toString()); if (Objects.nonNull(jsonResult)) {