From 1ba75d3e292b0abb6af6c63b04da0b4358508f80 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9A=AE=E5=85=89=EF=BC=9A=E5=9F=8E=E4=B8=AD=E5=9F=8E?=
<806783409@qq.com>
Date: Sun, 14 Nov 2021 23:05:24 +0800
Subject: [PATCH] =?UTF-8?q?=E5=90=84=E5=BC=82=E5=B8=B8=E6=83=85=E5=86=B5?=
=?UTF-8?q?=E5=B1=95=E7=A4=BA=E4=BC=98=E5=8C=96=EF=BC=8C=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=E7=8B=AC=E7=AB=8B=E7=9A=84=E6=8E=A5=E5=8F=A3=E8=AF=B7=E6=B1=82?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../impl/DbTableRelationServiceImpl.java | 10 +-
.../controller/vo/ProxyRequestResultVo.java | 10 +-
.../service/SwaggerHttpRequestService.java | 2 +-
.../src/components/layouts/PageLayout.vue | 13 +-
.../src/components/params/ParamTable.vue | 8 +-
zyplayer-doc-ui/swagger-ui/src/routes.js | 8 +
.../src/views/apiRequest/ApiRequest.vue | 215 +++++++++++++++++
.../src/views/apiRequest/ApiRequestResult.vue | 223 ++++++++++++++++++
.../src/views/doc/docView/DocContent.vue | 2 +-
.../src/views/doc/docView/DocDebugger.vue | 4 +-
.../views/doc/docView/DocDebuggerResult.vue | 124 ++++++----
11 files changed, 552 insertions(+), 67 deletions(-)
create mode 100644 zyplayer-doc-ui/swagger-ui/src/views/apiRequest/ApiRequest.vue
create mode 100644 zyplayer-doc-ui/swagger-ui/src/views/apiRequest/ApiRequestResult.vue
diff --git a/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/service/manage/impl/DbTableRelationServiceImpl.java b/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/service/manage/impl/DbTableRelationServiceImpl.java
index 7dfcd4e1..c11ecc1b 100644
--- a/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/service/manage/impl/DbTableRelationServiceImpl.java
+++ b/zyplayer-doc-data/src/main/java/com/zyplayer/doc/data/service/manage/impl/DbTableRelationServiceImpl.java
@@ -1,24 +1,20 @@
package com.zyplayer.doc.data.service.manage.impl;
import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.sun.jersey.server.impl.wadl.WadlResource;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zyplayer.doc.data.config.security.DocUserDetails;
import com.zyplayer.doc.data.config.security.DocUserUtil;
import com.zyplayer.doc.data.repository.manage.entity.DbTableRelation;
import com.zyplayer.doc.data.repository.manage.mapper.DbTableRelationMapper;
import com.zyplayer.doc.data.repository.manage.param.TableRelationParam;
-import com.zyplayer.doc.data.repository.manage.vo.TableRelationVo;
import com.zyplayer.doc.data.service.manage.DbTableRelationService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import javax.annotation.Resource;
-import java.util.*;
+import java.util.Date;
+import java.util.List;
/**
*
diff --git a/zyplayer-doc-swagger-plus/src/main/java/com/zyplayer/doc/swaggerplus/controller/vo/ProxyRequestResultVo.java b/zyplayer-doc-swagger-plus/src/main/java/com/zyplayer/doc/swaggerplus/controller/vo/ProxyRequestResultVo.java
index d48a6a44..04a26aab 100644
--- a/zyplayer-doc-swagger-plus/src/main/java/com/zyplayer/doc/swaggerplus/controller/vo/ProxyRequestResultVo.java
+++ b/zyplayer-doc-swagger-plus/src/main/java/com/zyplayer/doc/swaggerplus/controller/vo/ProxyRequestResultVo.java
@@ -8,7 +8,7 @@ public class ProxyRequestResultVo {
private List headers;
private Integer status;
private Long useTime;
- private Integer bodyLength;
+ private Integer contentLength;
private String data;
private String errorMsg;
@@ -60,11 +60,11 @@ public class ProxyRequestResultVo {
this.errorMsg = errorMsg;
}
- public Integer getBodyLength() {
- return bodyLength;
+ public Integer getContentLength() {
+ return contentLength;
}
- public void setBodyLength(Integer bodyLength) {
- this.bodyLength = bodyLength;
+ public void setContentLength(Integer contentLength) {
+ this.contentLength = contentLength;
}
}
diff --git a/zyplayer-doc-swagger-plus/src/main/java/com/zyplayer/doc/swaggerplus/service/SwaggerHttpRequestService.java b/zyplayer-doc-swagger-plus/src/main/java/com/zyplayer/doc/swaggerplus/service/SwaggerHttpRequestService.java
index 6c44bb78..b99551a9 100644
--- a/zyplayer-doc-swagger-plus/src/main/java/com/zyplayer/doc/swaggerplus/service/SwaggerHttpRequestService.java
+++ b/zyplayer-doc-swagger-plus/src/main/java/com/zyplayer/doc/swaggerplus/service/SwaggerHttpRequestService.java
@@ -111,7 +111,7 @@ public class SwaggerHttpRequestService {
HttpResponse httpResponse = httpRequest.timeout(10000).execute();
resultVo.setData(httpResponse.body());
resultVo.setStatus(httpResponse.getStatus());
- resultVo.setBodyLength(httpResponse.bodyBytes().length);
+ resultVo.setContentLength(httpResponse.bodyBytes().length);
// 设置返回的cookies
List responseCookies = httpResponse.getCookies();
if (CollectionUtils.isNotEmpty(responseCookies)) {
diff --git a/zyplayer-doc-ui/swagger-ui/src/components/layouts/PageLayout.vue b/zyplayer-doc-ui/swagger-ui/src/components/layouts/PageLayout.vue
index ff4ffc45..0d4b0b84 100644
--- a/zyplayer-doc-ui/swagger-ui/src/components/layouts/PageLayout.vue
+++ b/zyplayer-doc-ui/swagger-ui/src/components/layouts/PageLayout.vue
@@ -1,6 +1,6 @@
-
+
@@ -26,6 +26,7 @@
ignoreParamPath: [
"/data/export",
],
+ apiRequestIndex: 1,
}
},
computed: {
@@ -69,6 +70,16 @@
editPage(key, action) {
this[action](key);
},
+ editPageTab(key, action) {
+ if (action === 'add') {
+ this.addPageTab();
+ } else {
+ this.removePageTab(key);
+ }
+ },
+ addPageTab() {
+ this.$router.push({path: '/doc/apiRequest', query: {id: this.apiRequestIndex++}});
+ },
removePageTab(key) {
if (this.pageList.length === 1) {
this.$message.warning('这是最后一页,不能再关闭了啦');
diff --git a/zyplayer-doc-ui/swagger-ui/src/components/params/ParamTable.vue b/zyplayer-doc-ui/swagger-ui/src/components/params/ParamTable.vue
index e64804d4..2f1001f6 100644
--- a/zyplayer-doc-ui/swagger-ui/src/components/params/ParamTable.vue
+++ b/zyplayer-doc-ui/swagger-ui/src/components/params/ParamTable.vue
@@ -31,12 +31,16 @@
{{text||'-'}}
-
+
{{enums}}
-
+
{{enums}}
+
+ TRUE
+ FALSE
+
import('./views/doc/DocView.vue')
},
+ {
+ path: '/doc/apiRequest',
+ name: '接口请求',
+ meta: {
+ hidden: true,
+ },
+ component: () => import('./views/apiRequest/ApiRequest.vue')
+ },
]
},
]
diff --git a/zyplayer-doc-ui/swagger-ui/src/views/apiRequest/ApiRequest.vue b/zyplayer-doc-ui/swagger-ui/src/views/apiRequest/ApiRequest.vue
new file mode 100644
index 00000000..42888d3b
--- /dev/null
+++ b/zyplayer-doc-ui/swagger-ui/src/views/apiRequest/ApiRequest.vue
@@ -0,0 +1,215 @@
+
+
+
+
+
+ {{method.toUpperCase()}}
+
+
+
+ 发送请求
+
+
+
+
+
+
+
+
+
+
+ none
+ form-data
+ x-www-form-urlencoded
+ row
+ binary
+
+
+ JSON
+ HTML
+ XML
+ JavaScript
+ TEXT
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 收起参数
+ 展开参数
+
+
+
+
+
+
+
diff --git a/zyplayer-doc-ui/swagger-ui/src/views/apiRequest/ApiRequestResult.vue b/zyplayer-doc-ui/swagger-ui/src/views/apiRequest/ApiRequestResult.vue
new file mode 100644
index 00000000..5f3e66c5
--- /dev/null
+++ b/zyplayer-doc-ui/swagger-ui/src/views/apiRequest/ApiRequestResult.vue
@@ -0,0 +1,223 @@
+
+
+
+
+
+
+
+ 格式化
+ 原始值
+ 预览
+
+
+ JSON
+ HTML
+ XML
+ JavaScript
+ TEXT
+
+
+
+
+
+
+
+
+ {{resultDataContentOrigin}}
+
+
+
+
+
+
+
+
+
+
+
+
+ 状态码:{{resultData.status||'200'}}
+ 耗时:{{unitConvert.formatSeconds(resultData.useTime||0)}}
+ 大小:{{unitConvert.formatFileSize(resultData.contentLength||0)}}
+
+
+
+
+
+
+
+ {{result.data.errorMsg}}
+
+
+
+ 耗时:{{unitConvert.formatSeconds(resultData.useTime||0)}}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/zyplayer-doc-ui/swagger-ui/src/views/doc/docView/DocContent.vue b/zyplayer-doc-ui/swagger-ui/src/views/doc/docView/DocContent.vue
index 3dca23b6..e7bd1c53 100644
--- a/zyplayer-doc-ui/swagger-ui/src/views/doc/docView/DocContent.vue
+++ b/zyplayer-doc-ui/swagger-ui/src/views/doc/docView/DocContent.vue
@@ -2,7 +2,7 @@
{{docInfoShow.url}}
-
+
{{docInfoShow.method}}
{{docInfoShow.consumes}}
diff --git a/zyplayer-doc-ui/swagger-ui/src/views/doc/docView/DocDebugger.vue b/zyplayer-doc-ui/swagger-ui/src/views/doc/docView/DocDebugger.vue
index a81e982d..1fc77de0 100644
--- a/zyplayer-doc-ui/swagger-ui/src/views/doc/docView/DocDebugger.vue
+++ b/zyplayer-doc-ui/swagger-ui/src/views/doc/docView/DocDebugger.vue
@@ -11,7 +11,7 @@
-
+
@@ -55,7 +55,7 @@
展开参数
-
+
diff --git a/zyplayer-doc-ui/swagger-ui/src/views/doc/docView/DocDebuggerResult.vue b/zyplayer-doc-ui/swagger-ui/src/views/doc/docView/DocDebuggerResult.vue
index 5f12de8c..3cae78c9 100644
--- a/zyplayer-doc-ui/swagger-ui/src/views/doc/docView/DocDebuggerResult.vue
+++ b/zyplayer-doc-ui/swagger-ui/src/views/doc/docView/DocDebuggerResult.vue
@@ -1,52 +1,74 @@
-
-
-
-
-
- 格式化
- 原始值
- 预览
-
-
- JSON
- HTML
- XML
- JavaScript
- TEXT
-
-
-
-
-
-
-
-
- {{resultDataContentOrigin}}
-
-
-
-
-
-
-
-
-
-
-
-
- 状态码:{{resultData.status||'200'}}
- 耗时:{{unitConvert.formatSeconds(resultData.useTime||0)}}
- 大小:{{unitConvert.formatFileSize(resultData.bodyLength||0)}}
-
-
-
+
+
+
+
+
+
+ 格式化
+ 原始值
+ 预览
+
+
+ JSON
+ HTML
+ XML
+ JavaScript
+ TEXT
+
+
+
+
+
+
+
+
+ {{resultDataContentOrigin}}
+
+
+
+
+
+
+
+
+
+
+
+
+ 状态码:{{resultData.status||'200'}}
+ 耗时:{{unitConvert.formatSeconds(resultData.useTime||0)}}
+ 大小:{{unitConvert.formatFileSize(resultData.contentLength||0)}}
+
+
+
+
+
+
+
+ {{result.data.errorMsg}}
+
+
+
+ 耗时:{{unitConvert.formatSeconds(resultData.useTime||0)}}
+
+
+
+
+
+
+
@@ -72,6 +94,10 @@
type: Object,
required: true
},
+ loading: {
+ type: Boolean,
+ required: true
+ },
},
components: {
CloseOutlined, ParamTable, ParamBody, aceEditor
@@ -109,6 +135,8 @@
if (contentType && contentType.value) {
if (contentType.value.indexOf('text/html') >= 0) {
bodyShowFormatType.value = 'html';
+ } else if (contentType.value.indexOf('text/plain') >= 0) {
+ bodyShowFormatType.value = 'text';
} else if (contentType.value.indexOf('application/json') >= 0) {
bodyShowFormatType.value = 'json';
} else if (contentType.value.indexOf('application/xml') >= 0 || contentType.value.indexOf('text/xml') >= 0) {