Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f99b278e51 | ||
|
|
b25e0cd03b | ||
|
|
8a8cd1b295 |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -61,10 +61,3 @@ rebel.xml
|
||||
# 忽略office文件打开临时文件 #
|
||||
[~$]*.*
|
||||
tmlog.lck
|
||||
/.metadata/
|
||||
zyplayer-doc-data/bin
|
||||
zyplayer-doc-api/bin
|
||||
zyplayer-doc-core/bin
|
||||
zyplayer-doc-data/src/main/java/com/zyplayer/.metadata/
|
||||
zyplayer-doc-db/bin/
|
||||
zyplayer-doc-wiki/bin/
|
||||
93
README.md
93
README.md
@@ -1,15 +1,5 @@
|
||||
<p align="center">
|
||||
<img src="https://gitee.com/dromara/zyplayer-doc/raw/master/zyplayer-doc-other/resource/logo.png">
|
||||
</p>
|
||||
|
||||
<h1 align="center">zyplayer-doc</h1>
|
||||
|
||||
<p align="center">专注于私有化部署的在线知识库管理平台</p>
|
||||
|
||||
# 项目简介
|
||||
zyplayer-doc是一款适合团队和个人私有化部署使用的WIKI文档管理工具,同时还包含数据库管理、Api接口管理等模块。
|
||||
|
||||
适合作为公司内部或个人的知识库、笔记、文档管理工具,将文档发布成对外可访问的形式,可作为公司的产品文档、帮助文档等。
|
||||
zyplayer-doc是一款适合团队和个人使用的WIKI文档管理工具,同时还包含数据库文档、Api接口文档。
|
||||
|
||||
体验地址:[http://zyplayer.com](http://zyplayer.com)
|
||||
|
||||
@@ -20,50 +10,69 @@ zyplayer-doc是一款适合团队和个人私有化部署使用的WIKI文档管
|
||||
欢迎加入微信群与我们一起交流
|
||||
> 微信群员超过限制只能加好友拉进群,添加微信好友,回复:`加群` 即可
|
||||
|
||||

|
||||

|
||||
|
||||
# 快速启动
|
||||
## 相关依赖
|
||||
启动本系统仅依赖JAVA和MySQL
|
||||
- JAVA 1.8+
|
||||
- MySQL 5.7.x、8.x
|
||||
- MySQL 5.7.x
|
||||
|
||||
数据库安装成功后,需要您**手动创建**一个库:`zyplayer_doc`
|
||||
|
||||
```sql
|
||||
-- 建库语句
|
||||
create database zyplayer_doc;
|
||||
```
|
||||
|
||||
> 建表SQL脚本无需手动执行,每次启动或更新之后都会检查当前版本,然后自动执行升级SQL脚本,所以每次有版本更新需求只需要下载最新版本启动即可,无需其他特殊操作
|
||||
|
||||
## 宝塔面板一键部署
|
||||
- 安装宝塔面板,前往[宝塔面板](https://www.bt.cn/u/2OCdV3)官网,选择对应的脚本下载安装,宝塔版本:`9.2.0+`
|
||||
- 登录宝塔面板,在菜单栏中点击 Docker,根据提示安装 Docker 和 Docker Compose 服务,若已有则跳过
|
||||
- 在Docker-应用商店查询到 zyplayer-doc,点击安装
|
||||
- 设置域名等基本信息,点击确定
|
||||
- 提交后面板会自动进行应用初始化,大概需要1-5分钟,初始化完成后即可访问。
|
||||

|
||||
建表SQL脚本无需手动执行,每次启动或更新之后都会检查当前版本,然后自动执行升级SQL脚本,所以每次有版本更新需求只需要下载最新版本启动即可,无需其他特殊操作
|
||||
|
||||
## Main方法启动
|
||||
1. 修改`zyplayer-doc-manage/src/main/resources/application.yml`配置文件里面的数据库账号密码
|
||||
2. 执行`org.dromara.zyplayer.manage.Application.main`方法启动项目
|
||||
1. 修改`zyplayer-doc/zyplayer-doc-manage/src/main/resources/application.yml`配置文件里面的数据库账号密码
|
||||
2. 执行`com.zyplayer.doc.manage.Application.main`方法启动项目
|
||||
|
||||
## JAR方式启动
|
||||
1. 直接下载:直接下载编译好的jar打包文件,编译后的最新版可到 [发行版下载处](https://gitee.com/dromara/zyplayer-doc/releases) 去下载
|
||||
1. 直接下载:直接下载编译好的jar打包文件,编译后的最新版可到[在线文档](http://doc.zyplayer.com)右上角去下载
|
||||
2. 自行编译:也可以自己动手编译,双击执行:`zyplayer-doc\build.bat`,将使用maven编译整个项目为可执行的jar文件,编译结果文件放在:`zyplayer-doc\dist\version`文件夹下
|
||||
3. 修改第一步或第二步结果文件夹下的`application.yml`文件里面数据库帐号密码
|
||||
4. 双击第一步或第二步结果文件夹下的`startup.bat`启动项目
|
||||
|
||||
## Tomcat容器启动
|
||||
1. 直接下载编译好的war打包文件,编译后的最新版可到 [发行版下载处](https://gitee.com/dromara/zyplayer-doc/releases) 去下载
|
||||
1. 直接下载编译好的war打包文件,编译后的最新版可到[在线文档](http://doc.zyplayer.com)右上角去下载
|
||||
2. 修改配置文件:`zyplayer-doc.zip\apache-tomcat\webapps\zyplayer-doc\WEB-INF\classes\application.yml`配置文件里面的数据库账号密码
|
||||
3. 双击`tomcat\bin\startup.bat`启动即可
|
||||
|
||||
## 其他
|
||||
更多启动方式请参考文档:[项目下载与部署](http://doc.zyplayer.com/#/integrate/zyplayer-doc/opensource/279)
|
||||
启动后访问:[http://127.0.0.1:8083/zyplayer-doc](http://127.0.0.1:8083/zyplayer-doc) ,默认登录账号: **zyplayer** 密码: **123456**
|
||||
|
||||
启动后访问:[http://127.0.0.1:8083](http://127.0.0.1:8083) ,默认登录账号: **zyplayer** 密码: **123456**
|
||||
# 各模块介绍
|
||||
## zyplayer-doc-manage 文档管理后台
|
||||
1. 具有项目模块导航,人员及权限管理功能,分组管理等功能。
|
||||
2. 集成了本项目内的各个子模块功能,是各模块的协调管理模块。
|
||||
|
||||
## zyplayer-doc-wiki wiki文档工具
|
||||
1. 在线管理公司、项目及任意形式的文档
|
||||
2. 文档支持按空间划分,按人员分组授权,支持空间收藏和空间内的文档开放访问。
|
||||
3. 文档支持编辑、查看、评论、上传附件、历史版本查看、页面权限控制、文档搜索等功能。
|
||||
4. 文档编辑支持html富文本方式编辑和markdown的方式编辑。
|
||||
5. 本工具使用的开源工具有:vue、element-ui、mavon-editor、wangeditor等。
|
||||
6. 参考学习了Atlassian Confluence文档工具进行开发,争取作为该软件的开源免费替代产品,同时作为内部文档管理工具最好的存在。
|
||||
|
||||
## zyplayer-doc-db 数据库工具
|
||||
一款在线管理数据库的工具,你可以将所有的数据源统一管理到这里面,团队间的各成员就不必每人在自己电脑上装一个数据库管理软件,
|
||||
然后再添加数据源,可以统一修改数据库账号密码而不用群广播通知,新员工进入后对他使用到的数据源进行授权即可使用。
|
||||
|
||||
1. 支持MySQL、Doris(MySQL协议)、SQLServer、Oracle、达梦、PostgreSQL、Hive、Impala数据源。
|
||||
2. 支持数据库表、字段文档查看修改,表文档导出、建表语句DDL导出、表数据导出。
|
||||
3. 支持SQL执行、表数据预览、不同数据库之间的数据互导,支持多数据源管理。
|
||||
4. 支持按人员、按数据源对用户授权,可给用户 库表注释查看、注释修改、SQL执行、函数修改等粒度的授权。
|
||||
5. 支持库函数和存储过程的增删改查,修改记录查询等。
|
||||
6. 目标是取代Navicat,做一个小而精的开源免费的在线数据库管理工具。
|
||||
|
||||
## zyplayer-doc-api API接口文档管理工具
|
||||
一款支持统一管理Swagger文档、OpenApi文档、自建接口文档的管理工具,具有文档查看、接口请求、全局参数管理等功能,设计走心,前端代码使用最新技术构建,每一行代码都是全新手动敲出来的,超级简单明了,代码简洁美观可读性好、易维护。
|
||||
|
||||
1. 支持Swagger的文档展示,接口调试,解析速度快,界面设计走心。
|
||||
2. 支持将所有的Swagger文档、OpenApi文档、自建接口文档进行统一管理,支持全局参数设置,请求参数缓存,下次自动填充等。
|
||||
3. 目标是实现一个平台解决所有项目的接口文档统一管理。
|
||||
|
||||
## 其他
|
||||
1. zyplayer-doc-ui 前面各模块的前端UI源码
|
||||
2. zyplayer-doc-core 一些核心、公用的类
|
||||
3. zyplayer-doc-data 数据库层面的交互
|
||||
5. zyplayer-doc-other 一些测试
|
||||
|
||||
# 用爱发电
|
||||
如果您正在使用这个项目并感觉良好,或者是想支持项目继续开发,您可以通过如下`任意`方式支持我们:
|
||||
@@ -75,5 +84,17 @@ create database zyplayer_doc;
|
||||
控制台页面
|
||||

|
||||
|
||||
数据库文档页面
|
||||

|
||||
|
||||
WIKI文档页面
|
||||

|
||||
|
||||
API文档主页面
|
||||

|
||||
|
||||
API文档查看页面
|
||||

|
||||
|
||||
API文档在线调试页面
|
||||

|
||||
|
||||
@@ -20,7 +20,6 @@ md %target_dir%
|
||||
|
||||
copy zyplayer-doc-manage\target\zyplayer-doc.jar %target_dir%
|
||||
copy zyplayer-doc-manage\src\main\resources\application.yml %target_dir%
|
||||
copy zyplayer-doc-manage\src\main\resources\application_pg.yml %target_dir%
|
||||
|
||||
xcopy /e /y /q zyplayer-doc-other\script %target_dir%
|
||||
|
||||
|
||||
36
pom.xml
36
pom.xml
@@ -2,13 +2,13 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.dromara</groupId>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.1.5</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>zyplayer-doc</name>
|
||||
<description>zyplayer-doc文档管理系统</description>
|
||||
<description>定位为所有文档的管理项目,swagger文档、数据库文档、WIKI文档等</description>
|
||||
|
||||
<properties>
|
||||
<skipTests>true</skipTests>
|
||||
@@ -18,12 +18,14 @@
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<fastjson.version>1.2.53</fastjson.version>
|
||||
<zyplayer.doc.version>1.0.0</zyplayer.doc.version>
|
||||
<zyplayer.doc.version>1.1.5</zyplayer.doc.version>
|
||||
<spring.boot.version>2.1.6.RELEASE</spring.boot.version>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
<module>zyplayer-doc-manage</module>
|
||||
<module>zyplayer-doc-db</module>
|
||||
<module>zyplayer-doc-api</module>
|
||||
<module>zyplayer-doc-wiki</module>
|
||||
<module>zyplayer-doc-core</module>
|
||||
<module>zyplayer-doc-data</module>
|
||||
@@ -98,11 +100,6 @@
|
||||
<artifactId>curator-recipes</artifactId>
|
||||
<version>2.12.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-collections4</artifactId>
|
||||
<version>4.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
@@ -170,22 +167,27 @@
|
||||
<version>5.6.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.17.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-core</artifactId>
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-data</artifactId>
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-db</artifactId>
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-api</artifactId>
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-wiki</artifactId>
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
# 本文件用于已部署好的系统检测自己是否需要升级使用,怕有人担心安全一类的问题,所以不提供服务器接口来做
|
||||
lastVersion=1.1.6
|
||||
lastVersion=1.1.5
|
||||
|
||||
upgradeContent=1. 优化WIKI文档展示;\
|
||||
2. #I6S5YA 解决路由错误问题;\
|
||||
3. #I6Z8UX 解决表格样式问题;\
|
||||
4. #I6Z8UX 解决列表样式问题,修复保存后文档加载问题;\
|
||||
5. 升级fastjson版本;\
|
||||
6. 修复图片查看问题;\
|
||||
7. 移除错误的和不需要的依赖;\
|
||||
8. 修复保存后文档加载问题;
|
||||
upgradeContent=1. #I6S5YA 解决路由错误问题;\
|
||||
2. #I6Z8UX 解决表格样式问题;\
|
||||
3. #I6Z8UX 解决列表样式问题,修复保存后文档加载问题;\
|
||||
4. 升级fastjson版本;\
|
||||
5. 修复图片查看问题;\
|
||||
6. 移除错误的和不需要的依赖;\
|
||||
7. 修复保存后文档加载问题;
|
||||
|
||||
upgradeUrl=https://gitee.com/zyplayer/zyplayer-doc/releases
|
||||
nextStep=
|
||||
|
||||
96
zyplayer-doc-api/pom.xml
Normal file
96
zyplayer-doc-api/pom.xml
Normal file
@@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>zyplayer-doc-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>zyplayer-doc-api</name>
|
||||
<description>zyplayer-doc-api是一款接口文档管理系统</description>
|
||||
<url>https://gitee.com/zyplayer/zyplayer-doc/zyplayer-doc</url>
|
||||
<developers>
|
||||
<developer>
|
||||
<id>zyplayer</id>
|
||||
<name>暮光:城中城</name>
|
||||
<email>806783409@qq.com</email>
|
||||
<roles>
|
||||
<role>Java Development Engineer</role>
|
||||
</roles>
|
||||
<timezone>2018-05-22 16:06:06</timezone>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<parent>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc</artifactId>
|
||||
<version>1.1.5</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<!-- 打包跳过单元测试 -->
|
||||
<skipTests>true</skipTests>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-data</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The Apache Software License, Version 2.0</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
</license>
|
||||
</licenses>
|
||||
<scm>
|
||||
<connection>scm:git@git.oschina.net:zyplayer/zyplayer-doc.git</connection>
|
||||
<developerConnection>scm:git@git.oschina.net:zyplayer/zyplayer-doc.git</developerConnection>
|
||||
<url>git@git.oschina.net:zyplayer/zyplayer-doc.git</url>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>snapshots</id>
|
||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources/dist</directory>
|
||||
<targetPath>META-INF/resources/</targetPath>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.zyplayer.doc.api.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zyplayer.doc.api.controller.vo.ApiCustomParamsVo;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.*;
|
||||
import com.zyplayer.doc.data.service.common.ApiDocAuthJudgeService;
|
||||
import com.zyplayer.doc.data.service.manage.ApiCustomNodeService;
|
||||
import com.zyplayer.doc.data.service.manage.ApiCustomParamsService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 自建接口文档分组 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-12-22
|
||||
*/
|
||||
@AuthMan
|
||||
@Controller
|
||||
@RequestMapping("/api-custom-node")
|
||||
public class ApiCustomNodeController {
|
||||
|
||||
@Resource
|
||||
ApiCustomNodeService apiCustomNodeService;
|
||||
@Resource
|
||||
ApiCustomParamsService apiCustomParamsService;
|
||||
@Resource
|
||||
ApiDocAuthJudgeService apiDocAuthJudgeService;
|
||||
|
||||
/**
|
||||
* 1. 新增文件夹
|
||||
* 2. 修改文件夹名称说明等
|
||||
* 3. 修改父文件夹
|
||||
*
|
||||
* @return 文档内容
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年12月22日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/add")
|
||||
public ResponseJson<Object> add(ApiCustomNode apiCustomNode, ApiCustomParams apiCustomParams) {
|
||||
apiCustomNodeService.addNode(apiCustomNode, apiCustomParams);
|
||||
return DocResponseJson.ok(apiCustomNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文件夹
|
||||
*
|
||||
* @return 文档内容
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年12月22日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/update")
|
||||
public ResponseJson<Object> update(ApiCustomNode apiCustomNode) {
|
||||
// 参数未传不处理
|
||||
if (apiCustomNode.getId() == null) {
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
if (StringUtils.isBlank(apiCustomNode.getNodeName()) && StringUtils.isBlank(apiCustomNode.getNodeDesc())) {
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
ApiCustomNode apiCustomFolderSel = apiCustomNodeService.getById(apiCustomNode.getId());
|
||||
apiDocAuthJudgeService.judgeDevelopAndThrow(apiCustomFolderSel.getDocId());
|
||||
// 执行修改
|
||||
ApiCustomNode nodeUp = new ApiCustomNode();
|
||||
nodeUp.setId(apiCustomNode.getId());
|
||||
nodeUp.setNodeName(apiCustomNode.getNodeName());
|
||||
nodeUp.setNodeDesc(apiCustomNode.getNodeDesc());
|
||||
apiCustomNodeService.updateById(nodeUp);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件夹
|
||||
*
|
||||
* @return 文档内容
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年12月22日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/delete")
|
||||
public ResponseJson<Object> delete(Long id) {
|
||||
ApiCustomNode apiCustomFolderSel = apiCustomNodeService.getById(id);
|
||||
apiDocAuthJudgeService.judgeDevelopAndThrow(apiCustomFolderSel.getDocId());
|
||||
apiCustomNodeService.deleteNode(id);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件夹
|
||||
*
|
||||
* @return 文档内容
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年12月22日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/changeParent")
|
||||
public ResponseJson<Object> changeParent(Long id, Long parentId, Integer targetType, Integer targetSeq) {
|
||||
ApiCustomNode apiCustomFolderSel = apiCustomNodeService.getById(id);
|
||||
apiDocAuthJudgeService.judgeDevelopAndThrow(apiCustomFolderSel.getDocId());
|
||||
apiCustomNodeService.changeParent(id, parentId, targetType, targetSeq);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义接口详情
|
||||
*
|
||||
* @return 文档内容
|
||||
* @author 暮光:城中城
|
||||
* @since 2022年01月05日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/detail")
|
||||
public ResponseJson<Object> detail(Long id) {
|
||||
ApiCustomNode apiCustomNode = apiCustomNodeService.getById(id);
|
||||
if (apiCustomNode == null) {
|
||||
return DocResponseJson.warn("接口不存在");
|
||||
}
|
||||
apiDocAuthJudgeService.judgeDevelopAndThrow(apiCustomNode.getDocId());
|
||||
QueryWrapper<ApiCustomParams> paramsWrapper = new QueryWrapper<>();
|
||||
paramsWrapper.eq("yn", 1);
|
||||
paramsWrapper.eq("node_id", id);
|
||||
ApiCustomParams apiCustomParams = apiCustomParamsService.getOne(paramsWrapper);
|
||||
// 组装结果对象
|
||||
ApiCustomParamsVo customParamsVo = new ApiCustomParamsVo();
|
||||
customParamsVo.setId(apiCustomNode.getId());
|
||||
customParamsVo.setDocId(apiCustomNode.getDocId());
|
||||
customParamsVo.setParentId(apiCustomNode.getParentId());
|
||||
customParamsVo.setNodeType(apiCustomNode.getNodeType());
|
||||
customParamsVo.setNodeName(apiCustomNode.getNodeName());
|
||||
customParamsVo.setNodeDesc(apiCustomNode.getNodeDesc());
|
||||
customParamsVo.setSeqNo(apiCustomNode.getSeqNo());
|
||||
customParamsVo.setNodeId(apiCustomNode.getId());
|
||||
if (apiCustomParams != null) {
|
||||
customParamsVo.setMethod(apiCustomParams.getMethod());
|
||||
customParamsVo.setApiUrl(apiCustomParams.getApiUrl());
|
||||
customParamsVo.setFormData(apiCustomParams.getFormData());
|
||||
customParamsVo.setBodyData(apiCustomParams.getBodyData());
|
||||
customParamsVo.setHeaderData(apiCustomParams.getHeaderData());
|
||||
customParamsVo.setCookieData(apiCustomParams.getCookieData());
|
||||
}
|
||||
return DocResponseJson.ok(customParamsVo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.zyplayer.doc.api.controller;
|
||||
|
||||
import com.zyplayer.doc.api.controller.vo.DocUserAuthVo;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.*;
|
||||
import com.zyplayer.doc.data.repository.support.consts.ApiAuthType;
|
||||
import com.zyplayer.doc.data.repository.support.consts.DocSysModuleType;
|
||||
import com.zyplayer.doc.data.repository.support.consts.DocSysType;
|
||||
import com.zyplayer.doc.data.service.common.ApiDocAuthJudgeService;
|
||||
import com.zyplayer.doc.data.service.manage.ApiDocService;
|
||||
import com.zyplayer.doc.data.service.manage.AuthInfoService;
|
||||
import com.zyplayer.doc.data.service.manage.UserAuthService;
|
||||
import com.zyplayer.doc.data.service.manage.UserInfoService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* api权限控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年12月12日
|
||||
*/
|
||||
@AuthMan
|
||||
@RestController
|
||||
@RequestMapping("/doc-api/doc/auth")
|
||||
public class ApiDocAuthController {
|
||||
private static Logger logger = LoggerFactory.getLogger(ApiDocAuthController.class);
|
||||
|
||||
@Resource
|
||||
UserAuthService userAuthService;
|
||||
@Resource
|
||||
AuthInfoService authInfoService;
|
||||
@Resource
|
||||
UserInfoService userInfoService;
|
||||
@Resource
|
||||
ApiDocService apiDocService;
|
||||
@Resource
|
||||
ApiDocAuthJudgeService apiDocAuthJudgeService;
|
||||
|
||||
@PostMapping("/list")
|
||||
public ResponseJson<Object> list(Long docId) {
|
||||
if (!apiDocAuthJudgeService.haveManageAuth(docId)) {
|
||||
return DocResponseJson.warn("没有此文档的操作权限");
|
||||
}
|
||||
List<UserAuth> authList = userAuthService.getModuleAuthList(DocSysType.API.getType(), DocSysModuleType.Api.DOC.getType(), docId);
|
||||
if (CollectionUtils.isEmpty(authList)) {
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
// 权限ID对应的权限名
|
||||
Collection<AuthInfo> authInfoList = authInfoService.listByIds(authList.stream().map(UserAuth::getAuthId).collect(Collectors.toSet()));
|
||||
Map<Long, String> authInfoMap = authInfoList.stream().collect(Collectors.toMap(AuthInfo::getId, AuthInfo::getAuthName));
|
||||
Collection<UserInfo> userInfoList = userInfoService.listByIds(authList.stream().map(UserAuth::getUserId).collect(Collectors.toSet()));
|
||||
Map<Long, UserInfo> userInfoMap = userInfoList.stream().collect(Collectors.toMap(UserInfo::getId, val -> val));
|
||||
// 返回结果组装
|
||||
List<DocUserAuthVo> authVoList = new LinkedList<>();
|
||||
for (UserAuth userAuth : authList) {
|
||||
UserInfo userInfo = userInfoMap.get(userAuth.getUserId());
|
||||
String authCode = authInfoMap.get(userAuth.getAuthId());
|
||||
DocUserAuthVo authVo = new DocUserAuthVo();
|
||||
authVo.setAuthType(ApiAuthType.typeOf(authCode).getType());
|
||||
authVo.setUserId(userAuth.getUserId());
|
||||
authVo.setUserNo(userInfo.getUserNo());
|
||||
authVo.setUserName(userInfo.getUserName());
|
||||
authVo.setEmail(userInfo.getEmail());
|
||||
authVo.setPhone(userInfo.getPhone());
|
||||
authVo.setSex(userInfo.getSex());
|
||||
authVoList.add(authVo);
|
||||
}
|
||||
return DocResponseJson.ok(authVoList);
|
||||
}
|
||||
|
||||
@PostMapping("/assign")
|
||||
public ResponseJson<Object> assign(Long docId, Long userId, Integer authType) {
|
||||
if (!apiDocAuthJudgeService.haveManageAuth(docId)) {
|
||||
return DocResponseJson.warn("没有此文档的操作权限");
|
||||
}
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
String authCode = ApiAuthType.typeOf(authType).getCode();
|
||||
AuthInfo authInfo = authInfoService.getByCode(authCode);
|
||||
List<UserAuth> userModuleAuthList = userAuthService.getUserModuleAuthList(userId, DocSysType.API.getType(), DocSysModuleType.Api.DOC.getType(), docId);
|
||||
if (CollectionUtils.isNotEmpty(userModuleAuthList)) {
|
||||
UserAuth userAuth = userModuleAuthList.remove(0);
|
||||
// 错误数据兼容移除
|
||||
if (userModuleAuthList.size() > 0) {
|
||||
List<Long> authIdList = userModuleAuthList.stream().map(UserAuth::getId).collect(Collectors.toList());
|
||||
userAuthService.removeByIds(authIdList);
|
||||
}
|
||||
userAuth.setAuthId(authInfo.getId());
|
||||
userAuth.setUpdateTime(new Date());
|
||||
userAuth.setUpdateUid(currentUser.getUserId());
|
||||
userAuthService.updateById(userAuth);
|
||||
} else {
|
||||
UserAuth userAuth = new UserAuth();
|
||||
userAuth.setUserId(userId);
|
||||
userAuth.setSysType(DocSysType.API.getType());
|
||||
userAuth.setSysModuleType(DocSysModuleType.Api.DOC.getType());
|
||||
userAuth.setSysModuleId(docId);
|
||||
userAuth.setAuthId(authInfo.getId());
|
||||
userAuth.setCreationTime(new Date());
|
||||
userAuth.setCreateUid(currentUser.getUserId());
|
||||
userAuth.setUpdateTime(new Date());
|
||||
userAuth.setUpdateUid(currentUser.getUserId());
|
||||
userAuth.setDelFlag(0);
|
||||
userAuthService.save(userAuth);
|
||||
}
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public ResponseJson<Object> delete(Long docId, Long userId) {
|
||||
if (!apiDocAuthJudgeService.haveManageAuth(docId)) {
|
||||
return DocResponseJson.warn("没有此文档的操作权限");
|
||||
}
|
||||
userAuthService.deleteUserModuleAuth(userId, DocSysType.API.getType(), DocSysModuleType.Api.DOC.getType(), docId);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
package com.zyplayer.doc.api.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zyplayer.doc.api.framework.utils.SwaggerDocUtil;
|
||||
import com.zyplayer.doc.api.service.SwaggerHttpRequestService;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiDoc;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.ApiCustomDocVo;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.ApiDocVo;
|
||||
import com.zyplayer.doc.data.repository.support.consts.ApiAuthType;
|
||||
import com.zyplayer.doc.data.service.common.ApiDocAuthJudgeService;
|
||||
import com.zyplayer.doc.data.service.manage.ApiCustomNodeService;
|
||||
import com.zyplayer.doc.data.service.manage.ApiDocService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.swagger.web.SwaggerResource;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 文档控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@AuthMan
|
||||
@RestController
|
||||
@RequestMapping("/doc-api/doc")
|
||||
public class ApiDocumentController {
|
||||
private static Logger logger = LoggerFactory.getLogger(ApiDocumentController.class);
|
||||
|
||||
@Resource
|
||||
ApiDocAuthJudgeService apiDocAuthJudgeService;
|
||||
@Resource
|
||||
private ApiDocService apiDocService;
|
||||
@Resource
|
||||
private SwaggerHttpRequestService swaggerHttpRequestService;
|
||||
@Resource
|
||||
ApiCustomNodeService apiCustomNodeService;
|
||||
|
||||
/**
|
||||
* 获取所有的文档地址
|
||||
*
|
||||
* @return 文档内容
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/list")
|
||||
public ResponseJson<List<ApiDocVo>> list(ApiDoc apiDoc, Integer pageNum, Integer pageSize) {
|
||||
IPage<ApiDocVo> docList = apiDocService.getApiDocList(apiDoc, pageNum, pageSize);
|
||||
return DocResponseJson.ok(docList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文档内容
|
||||
*
|
||||
* @return 文档内容
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/detail")
|
||||
public ResponseJson<List<ApiDoc>> detail(Long id) {
|
||||
ApiDoc apiDoc = apiDocService.getById(id);
|
||||
if (!apiDocAuthJudgeService.haveDevelopAuth(apiDoc)) {
|
||||
return DocResponseJson.warn("没有此文档的查看权限");
|
||||
}
|
||||
ApiDocVo apiDocVo = new ApiDocVo();
|
||||
BeanUtil.copyProperties(apiDoc, apiDocVo);
|
||||
Integer authType = apiDocAuthJudgeService.haveManageAuth(apiDoc) ? ApiAuthType.MANAGE.getType() : ApiAuthType.DEVELOPER.getType();
|
||||
apiDocVo.setAuthType(authType);
|
||||
return DocResponseJson.ok(apiDocVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加文档
|
||||
*
|
||||
* @return 文档内容
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/add")
|
||||
public ResponseJson<Object> add(HttpServletRequest request, ApiDoc apiDoc) {
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
apiDoc.setYn(1);
|
||||
apiDoc.setCreateTime(new Date());
|
||||
apiDoc.setCreateUserId(currentUser.getUserId());
|
||||
apiDoc.setCreateUserName(currentUser.getUsername());
|
||||
if (apiDoc.getId() == null) {
|
||||
apiDoc.setShareUuid(IdUtil.simpleUUID());
|
||||
} else {
|
||||
ApiDoc apiDocSel = apiDocService.getById(apiDoc.getId());
|
||||
if (apiDocSel == null) {
|
||||
return DocResponseJson.warn("未找到指定的文档记录信息");
|
||||
}
|
||||
if (!apiDocAuthJudgeService.haveManageAuth(apiDocSel)) {
|
||||
return DocResponseJson.warn("没有此文档的操作权限");
|
||||
}
|
||||
if (StringUtils.isBlank(apiDocSel.getShareUuid())) {
|
||||
apiDoc.setShareUuid(IdUtil.simpleUUID());
|
||||
}
|
||||
}
|
||||
// url类型
|
||||
if (Objects.equals(apiDoc.getDocType(), 1)) {
|
||||
// UI地址替换为文档json地址
|
||||
String docUrl = SwaggerDocUtil.replaceSwaggerResources(apiDoc.getDocUrl());
|
||||
if (SwaggerDocUtil.isSwaggerResources(docUrl)) {
|
||||
String swaggerDomain = SwaggerDocUtil.getSwaggerResourceDomain(docUrl);
|
||||
List<SwaggerResource> resourceList;
|
||||
try {
|
||||
String resourcesStr = swaggerHttpRequestService.requestSwaggerUrl(request, 0L, docUrl, swaggerDomain);
|
||||
resourceList = JSON.parseArray(resourcesStr, SwaggerResource.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return DocResponseJson.warn("解析文档地址失败:" + e.getMessage());
|
||||
}
|
||||
if (resourceList == null || resourceList.isEmpty()) {
|
||||
return DocResponseJson.warn("该地址未找到文档");
|
||||
}
|
||||
// 删除原有文档
|
||||
if (apiDoc.getId() != null) {
|
||||
apiDocService.removeById(apiDoc.getId());
|
||||
}
|
||||
// 存明细地址
|
||||
for (SwaggerResource resource : resourceList) {
|
||||
apiDoc.setId(null);
|
||||
apiDoc.setDocUrl(swaggerDomain + resource.getUrl());
|
||||
apiDoc.setName(resource.getName());
|
||||
apiDoc.setShareUuid(IdUtil.simpleUUID());
|
||||
apiDocService.save(apiDoc);
|
||||
}
|
||||
} else {
|
||||
apiDocService.saveOrUpdate(apiDoc);
|
||||
}
|
||||
} else if (Objects.equals(apiDoc.getDocType(), 2)
|
||||
|| Objects.equals(apiDoc.getDocType(), 3)
|
||||
|| Objects.equals(apiDoc.getDocType(), 4)
|
||||
|| Objects.equals(apiDoc.getDocType(), 5)) {
|
||||
apiDocService.saveOrUpdate(apiDoc);
|
||||
} else {
|
||||
return DocResponseJson.warn("暂不支持的文档类型");
|
||||
}
|
||||
return DocResponseJson.ok(apiDoc);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文档基本信息
|
||||
*
|
||||
* @return 无
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/update")
|
||||
public ResponseJson<List<ApiDoc>> update(ApiDoc apiDoc) {
|
||||
if (apiDoc.getId() == null) {
|
||||
return DocResponseJson.warn("请指定修改的记录ID");
|
||||
}
|
||||
// 基本信息可以改,删除需要管理员权限
|
||||
if (Objects.equals(apiDoc.getYn(), 0)) {
|
||||
if (!apiDocAuthJudgeService.haveManageAuth(apiDoc.getId())) {
|
||||
return DocResponseJson.warn("没有此文档的删除权限");
|
||||
}
|
||||
} else {
|
||||
if (!apiDocAuthJudgeService.haveDevelopAuth(apiDoc.getId())) {
|
||||
return DocResponseJson.warn("没有此文档的编辑权限");
|
||||
}
|
||||
}
|
||||
ApiDoc swaggerDocUp = new ApiDoc();
|
||||
swaggerDocUp.setId(apiDoc.getId());
|
||||
swaggerDocUp.setDocStatus(apiDoc.getDocStatus());
|
||||
swaggerDocUp.setShareInstruction(apiDoc.getShareInstruction());
|
||||
swaggerDocUp.setYn(apiDoc.getYn());
|
||||
apiDocService.updateById(swaggerDocUp);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/apis")
|
||||
public ResponseJson<List<ApiDoc>> resources() {
|
||||
List<ApiDoc> docList = apiDocService.getApiDocList();
|
||||
return DocResponseJson.ok(docList);
|
||||
}
|
||||
|
||||
@RequestMapping("/apis/detail")
|
||||
public ResponseJson<Object> detail(HttpServletRequest request, Long id) {
|
||||
ApiDoc apiDoc = apiDocService.getById(id);
|
||||
if (apiDoc == null) {
|
||||
return DocResponseJson.warn("文档不存在");
|
||||
}
|
||||
if (!apiDocAuthJudgeService.haveDevelopAuth(apiDoc)) {
|
||||
return DocResponseJson.warn("没有此文档的查看权限");
|
||||
}
|
||||
if (Objects.equals(apiDoc.getDocType(), 1) || Objects.equals(apiDoc.getDocType(), 3)) {
|
||||
try {
|
||||
String docsDomain = SwaggerDocUtil.getV2ApiDocsDomain(apiDoc.getDocUrl());
|
||||
String contentStr = swaggerHttpRequestService.requestSwaggerUrl(request, apiDoc.getId(), apiDoc.getDocUrl(), docsDomain);
|
||||
return DocResponseJson.ok(contentStr);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return DocResponseJson.warn("请求文档失败");
|
||||
}
|
||||
}
|
||||
if (Objects.equals(apiDoc.getDocType(), 2) || Objects.equals(apiDoc.getDocType(), 4)) {
|
||||
return DocResponseJson.ok(apiDoc.getJsonContent());
|
||||
}
|
||||
if (Objects.equals(apiDoc.getDocType(), 5)) {
|
||||
List<ApiCustomDocVo> customVoList = apiCustomNodeService.buildCustomApiList(apiDoc);
|
||||
return DocResponseJson.ok(customVoList);
|
||||
}
|
||||
return DocResponseJson.warn("暂不支持的文档类型");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.zyplayer.doc.api.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiDoc;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiGlobalParam;
|
||||
import com.zyplayer.doc.data.service.common.ApiDocAuthJudgeService;
|
||||
import com.zyplayer.doc.data.service.manage.ApiGlobalParamService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 全局参数控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@AuthMan
|
||||
@RestController
|
||||
@RequestMapping("/doc-api/global-param")
|
||||
public class ApiGlobalParamController {
|
||||
private static Logger logger = LoggerFactory.getLogger(ApiGlobalParamController.class);
|
||||
|
||||
@Resource
|
||||
private ApiGlobalParamService apiGlobalParamService;
|
||||
@Resource
|
||||
ApiDocAuthJudgeService apiDocAuthJudgeService;
|
||||
|
||||
/**
|
||||
* 获取所有的全局参数
|
||||
*
|
||||
* @return 全局参数列表
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/list")
|
||||
public ResponseJson<List<ApiGlobalParam>> list(Long docId) {
|
||||
Long docIdNew = Optional.ofNullable(docId).orElse(0L);
|
||||
if (docIdNew > 0 && !apiDocAuthJudgeService.haveDevelopAuth(docIdNew)) {
|
||||
return DocResponseJson.warn("没有此文档的查看权限");
|
||||
}
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
QueryWrapper<ApiGlobalParam> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("yn", 1);
|
||||
queryWrapper.eq("doc_id", docIdNew);
|
||||
// 全局参数才按创建人来控制,文档的全局参数大家共用
|
||||
queryWrapper.eq(docIdNew == 0, "create_user_id", currentUser.getUserId());
|
||||
queryWrapper.orderByDesc("id");
|
||||
List<ApiGlobalParam> globalParamList = apiGlobalParamService.list(queryWrapper);
|
||||
return DocResponseJson.ok(globalParamList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改全局参数
|
||||
*
|
||||
* @return 无
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/update")
|
||||
public ResponseJson<List<ApiDoc>> update(ApiGlobalParam globalParam) {
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
globalParam.setDocId(Optional.ofNullable(globalParam.getDocId()).orElse(0L));
|
||||
// 新的文档ID是否有权限
|
||||
if (globalParam.getDocId() > 0 && !apiDocAuthJudgeService.haveDevelopAuth(globalParam.getDocId())) {
|
||||
return DocResponseJson.warn("没有此文档的查看权限");
|
||||
}
|
||||
if (globalParam.getId() == null) {
|
||||
globalParam.setYn(1);
|
||||
globalParam.setCreateTime(new Date());
|
||||
globalParam.setCreateUserId(currentUser.getUserId());
|
||||
globalParam.setCreateUserName(currentUser.getUsername());
|
||||
} else {
|
||||
ApiGlobalParam param = apiGlobalParamService.getById(globalParam.getId());
|
||||
if (param.getDocId() > 0) {
|
||||
// 已有的文档ID是否有权限
|
||||
if (!apiDocAuthJudgeService.haveDevelopAuth(param.getDocId())) {
|
||||
return DocResponseJson.warn("没有此文档的查看权限");
|
||||
}
|
||||
} else {
|
||||
if (!Objects.equals(param.getCreateUserId(), currentUser.getUserId())) {
|
||||
return DocResponseJson.warn("目标全局参数不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
QueryWrapper<ApiGlobalParam> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("yn", 1);
|
||||
wrapper.eq("param_key", globalParam.getParamKey());
|
||||
wrapper.eq("doc_id", globalParam.getDocId());
|
||||
// 全局参数才按创建人来控制,文档的全局参数大家共用
|
||||
wrapper.eq(globalParam.getDocId() == 0, "create_user_id", currentUser.getUserId());
|
||||
List<ApiGlobalParam> paramList = apiGlobalParamService.list(wrapper);
|
||||
if (CollectionUtils.isNotEmpty(paramList)) {
|
||||
if (paramList.size() > 1 || !Objects.equals(paramList.get(0).getId(), globalParam.getId())) {
|
||||
return DocResponseJson.warn("全局参数名称不能重复");
|
||||
}
|
||||
}
|
||||
apiGlobalParamService.saveOrUpdate(globalParam);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.zyplayer.doc.api.controller;
|
||||
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.api.controller.param.ProxyRequestParam;
|
||||
import com.zyplayer.doc.api.controller.vo.ProxyRequestResultVo;
|
||||
import com.zyplayer.doc.api.service.SwaggerHttpRequestService;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiCustomNode;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiCustomParams;
|
||||
import com.zyplayer.doc.data.service.manage.ApiCustomNodeService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 请求参数控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@AuthMan
|
||||
@RestController
|
||||
@RequestMapping("/doc-api/proxy")
|
||||
public class ApiPoxyRequestController {
|
||||
private static Logger logger = LoggerFactory.getLogger(ApiPoxyRequestController.class);
|
||||
|
||||
@Resource
|
||||
ApiCustomNodeService apiCustomNodeService;
|
||||
@Resource
|
||||
private SwaggerHttpRequestService swaggerHttpRequestService;
|
||||
|
||||
/**
|
||||
* 代理接口请求
|
||||
*
|
||||
* @return 请求参数
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/request")
|
||||
public ResponseJson<ProxyRequestResultVo> request(HttpServletRequest request, ProxyRequestParam requestParam) {
|
||||
// 自建接口请求时保存信息
|
||||
if (requestParam.getNodeId() != null) {
|
||||
ApiCustomNode apiCustomNode = new ApiCustomNode();
|
||||
apiCustomNode.setNodeType(1);
|
||||
apiCustomNode.setId(requestParam.getNodeId());
|
||||
apiCustomNode.setDocId(requestParam.getDocId());
|
||||
apiCustomNode.setNodeName(requestParam.getApiName());
|
||||
ApiCustomParams apiCustomParams = new ApiCustomParams();
|
||||
apiCustomParams.setApiUrl(requestParam.getUrl());
|
||||
apiCustomParams.setMethod(requestParam.getMethod());
|
||||
apiCustomParams.setFormData(requestParam.getFormParam());
|
||||
apiCustomParams.setBodyData(requestParam.getBodyParam());
|
||||
apiCustomParams.setHeaderData(requestParam.getHeaderParam());
|
||||
apiCustomParams.setCookieData(requestParam.getCookieParam());
|
||||
apiCustomNodeService.addNode(apiCustomNode, apiCustomParams);
|
||||
}
|
||||
ProxyRequestResultVo requestResult = swaggerHttpRequestService.proxyRequest(request, requestParam);
|
||||
return DocResponseJson.ok(requestResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* 代理接口下载请求
|
||||
*
|
||||
* @return 请求参数
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/download")
|
||||
public ResponseJson<ProxyRequestResultVo> download(HttpServletRequest request, HttpServletResponse response, ProxyRequestParam requestParam) {
|
||||
swaggerHttpRequestService.proxyDownload(request, response, requestParam);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.zyplayer.doc.api.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiDoc;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiRequestParam;
|
||||
import com.zyplayer.doc.data.service.manage.ApiRequestParamService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 请求参数控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@AuthMan
|
||||
@RestController
|
||||
@RequestMapping("/doc-api/request-param")
|
||||
public class ApiRequestParamController {
|
||||
private static Logger logger = LoggerFactory.getLogger(ApiRequestParamController.class);
|
||||
|
||||
@Resource
|
||||
private ApiRequestParamService apiRequestParamService;
|
||||
|
||||
/**
|
||||
* 获取所有的请求参数
|
||||
*
|
||||
* @return 请求参数
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/query")
|
||||
public ResponseJson<ApiRequestParam> query(String docUrl) {
|
||||
QueryWrapper<ApiRequestParam> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("yn", 1);
|
||||
queryWrapper.eq("doc_url", docUrl);
|
||||
ApiRequestParam requestParam = apiRequestParamService.getOne(queryWrapper);
|
||||
return DocResponseJson.ok(requestParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改请求参数
|
||||
*
|
||||
* @return 无
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/update")
|
||||
public ResponseJson<List<ApiDoc>> update(ApiRequestParam apiRequestParam) {
|
||||
QueryWrapper<ApiRequestParam> updateWrapper = new QueryWrapper<>();
|
||||
updateWrapper.eq("doc_url", apiRequestParam.getDocUrl());
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
apiRequestParam.setYn(1);
|
||||
apiRequestParam.setCreateTime(new Date());
|
||||
apiRequestParam.setCreateUserId(currentUser.getUserId());
|
||||
apiRequestParam.setCreateUserName(currentUser.getUsername());
|
||||
apiRequestParamService.update(apiRequestParam, updateWrapper);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.zyplayer.doc.api.controller;
|
||||
|
||||
import com.zyplayer.doc.api.framework.utils.SwaggerDocUtil;
|
||||
import com.zyplayer.doc.api.service.SwaggerHttpRequestService;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiDoc;
|
||||
import com.zyplayer.doc.data.service.manage.ApiDocService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 文档控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/doc-api/share")
|
||||
public class ApiShareDocumentController {
|
||||
private static Logger logger = LoggerFactory.getLogger(ApiShareDocumentController.class);
|
||||
|
||||
@Resource
|
||||
private ApiDocService swaggerDocService;
|
||||
@Resource
|
||||
private SwaggerHttpRequestService swaggerHttpRequestService;
|
||||
|
||||
/**
|
||||
* 获取文档内容
|
||||
*
|
||||
* @return 文档内容
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/detail")
|
||||
public ResponseJson<List<ApiDoc>> detail(String shareUuid) {
|
||||
ApiDoc apiDoc = swaggerDocService.getByShareUuid(shareUuid);
|
||||
if (apiDoc == null) {
|
||||
return DocResponseJson.warn("文档不存在");
|
||||
}
|
||||
apiDoc.setDocUrl(null);
|
||||
apiDoc.setJsonContent(null);
|
||||
return DocResponseJson.ok(apiDoc);
|
||||
}
|
||||
|
||||
@RequestMapping("/apis/detail")
|
||||
public ResponseJson<Object> detail(HttpServletRequest request, String shareUuid) {
|
||||
ApiDoc apiDoc = swaggerDocService.getByShareUuid(shareUuid);
|
||||
if (apiDoc == null) {
|
||||
return DocResponseJson.warn("文档不存在");
|
||||
}
|
||||
if (Objects.equals(apiDoc.getDocType(), 1)) {
|
||||
try {
|
||||
String docsDomain = SwaggerDocUtil.getV2ApiDocsDomain(apiDoc.getDocUrl());
|
||||
String contentStr = swaggerHttpRequestService.requestSwaggerUrl(request, apiDoc.getId(), apiDoc.getDocUrl(), docsDomain);
|
||||
return DocResponseJson.ok(contentStr);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return DocResponseJson.warn("请求文档失败");
|
||||
}
|
||||
}
|
||||
if (Objects.equals(apiDoc.getDocType(), 2) || Objects.equals(apiDoc.getDocType(), 4)) {
|
||||
return DocResponseJson.ok(apiDoc.getJsonContent());
|
||||
}
|
||||
return DocResponseJson.warn("暂不支持的文档类型");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.zyplayer.doc.api.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.exception.ConfirmException;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiDoc;
|
||||
import com.zyplayer.doc.data.service.manage.ApiDocService;
|
||||
import com.zyplayer.doc.api.controller.vo.SwaggerResourceVo;
|
||||
import com.zyplayer.doc.api.framework.utils.SwaggerDocUtil;
|
||||
import com.zyplayer.doc.api.service.SwaggerHttpRequestService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.MimeTypeUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.spring.web.json.Json;
|
||||
import springfox.documentation.swagger.web.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 承接了所有的ApiResourceController的接口
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@AuthMan
|
||||
@RestController
|
||||
public class ApiSwaggerProxyController {
|
||||
|
||||
private static final String HAL_MEDIA_TYPE = "application/hal+json";
|
||||
|
||||
@Resource
|
||||
private ApiDocService apiDocService;
|
||||
@Resource
|
||||
private SwaggerHttpRequestService swaggerHttpRequestService;
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/swagger-resources")
|
||||
public List<SwaggerResourceVo> swaggerResources() {
|
||||
List<SwaggerResourceVo> resourceList = new LinkedList<>();
|
||||
QueryWrapper<ApiDoc> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("yn", 1);
|
||||
queryWrapper.eq("doc_status", 1);
|
||||
queryWrapper.eq("open_visit", 1);
|
||||
queryWrapper.in("doc_type", 1, 2);
|
||||
queryWrapper.orderByAsc("id");
|
||||
queryWrapper.select("id", "name", "rewrite_domain");
|
||||
List<ApiDoc> docList = apiDocService.list(queryWrapper);
|
||||
for (ApiDoc apiDoc : docList) {
|
||||
SwaggerResourceVo resource = new SwaggerResourceVo();
|
||||
resource.setUrl("/v2/api-docs?id=" + apiDoc.getId());
|
||||
resource.setName(apiDoc.getName());
|
||||
resource.setSwaggerVersion("2.0");
|
||||
resource.setRewriteDomain(apiDoc.getRewriteDomain());
|
||||
resourceList.add(resource);
|
||||
}
|
||||
return resourceList;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/v2/api-docs", produces = {MimeTypeUtils.APPLICATION_JSON_VALUE, HAL_MEDIA_TYPE})
|
||||
public ResponseEntity<Object> content(HttpServletRequest request, Long id) {
|
||||
ApiDoc apiDoc = apiDocService.getById(id);
|
||||
if (apiDoc == null || !Objects.equals(apiDoc.getOpenVisit(), 1)) {
|
||||
throw new ConfirmException("文档不存在");
|
||||
}
|
||||
if (Objects.equals(apiDoc.getDocType(), 1)) {
|
||||
try {
|
||||
String docsDomain = SwaggerDocUtil.getV2ApiDocsDomain(apiDoc.getDocUrl());
|
||||
String contentStr = swaggerHttpRequestService.requestSwaggerUrl(request, apiDoc.getId(), apiDoc.getDocUrl(), docsDomain);
|
||||
return new ResponseEntity<>(new Json(contentStr), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity<>(DocResponseJson.warn("请求文档失败"), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
return new ResponseEntity<>(new Json(apiDoc.getJsonContent()), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/swagger-resources/configuration/security")
|
||||
public ResponseEntity<SecurityConfiguration> securityConfiguration() {
|
||||
SecurityConfiguration securityConfiguration = SecurityConfigurationBuilder.builder().build();
|
||||
return new ResponseEntity<>(securityConfiguration, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/swagger-resources/configuration/ui")
|
||||
public ResponseEntity<UiConfiguration> uiConfiguration() {
|
||||
UiConfiguration uiConfiguration = UiConfigurationBuilder.builder().build();
|
||||
return new ResponseEntity<>(uiConfiguration, HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.zyplayer.doc.api.controller.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 参数信息
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
@Data
|
||||
public class ParamData {
|
||||
private String code;
|
||||
private String value;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.zyplayer.doc.api.controller.param;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 代理请求参数
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
@Data
|
||||
public class ProxyRequestParam {
|
||||
private Long docId;
|
||||
private Long nodeId;
|
||||
private String url;
|
||||
private String host;
|
||||
private String method;
|
||||
private String contentType;
|
||||
private String headerParam;
|
||||
private String cookieParam;
|
||||
private String formParam;
|
||||
private String formEncodeParam;
|
||||
private String bodyParam;
|
||||
private String apiName;
|
||||
|
||||
public List<ParamData> getHeaderParamData() {
|
||||
return JSON.parseArray(headerParam, ParamData.class);
|
||||
}
|
||||
|
||||
public List<ParamData> getCookieParamData() {
|
||||
return JSON.parseArray(cookieParam, ParamData.class);
|
||||
}
|
||||
|
||||
public List<ParamData> getFormParamData() {
|
||||
return JSON.parseArray(formParam, ParamData.class);
|
||||
}
|
||||
|
||||
public List<ParamData> getFormEncodeParamData() {
|
||||
return JSON.parseArray(formEncodeParam, ParamData.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.zyplayer.doc.api.controller.vo;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApiCustomParamsVo {
|
||||
|
||||
/**
|
||||
* 节点ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 父文件夹ID
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 节点类型 0=目录 1=接口
|
||||
*/
|
||||
private Integer nodeType;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
private String nodeName;
|
||||
|
||||
/**
|
||||
* 节点说明
|
||||
*/
|
||||
private String nodeDesc;
|
||||
|
||||
/**
|
||||
* 节点顺序
|
||||
*/
|
||||
private Integer seqNo;
|
||||
|
||||
/**
|
||||
* api_doc主键ID
|
||||
*/
|
||||
private Long docId;
|
||||
|
||||
/**
|
||||
* 节点ID
|
||||
*/
|
||||
private Long nodeId;
|
||||
|
||||
/**
|
||||
* 请求方式:get、head、post、put、patch、delete、options、trace
|
||||
*/
|
||||
private String method;
|
||||
|
||||
/**
|
||||
* 接口url
|
||||
*/
|
||||
private String apiUrl;
|
||||
|
||||
/**
|
||||
* form参数
|
||||
*/
|
||||
private String formData;
|
||||
|
||||
/**
|
||||
* body参数
|
||||
*/
|
||||
private String bodyData;
|
||||
|
||||
/**
|
||||
* header参数
|
||||
*/
|
||||
private String headerData;
|
||||
|
||||
/**
|
||||
* cookie参数
|
||||
*/
|
||||
private String cookieData;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.zyplayer.doc.api.controller.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* api文档地址Vo
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-25
|
||||
*/
|
||||
@Data
|
||||
public class ApiDocVo implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文档名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 文档类型 1=swagger url 2=swagger json 3=openapi url 4=openapi json 5=自建API分组
|
||||
*/
|
||||
private Integer docType;
|
||||
|
||||
/**
|
||||
* 文档URL地址
|
||||
*/
|
||||
private String docUrl;
|
||||
|
||||
/**
|
||||
* 文档json内容
|
||||
*/
|
||||
private String jsonContent;
|
||||
|
||||
/**
|
||||
* 重写的域名
|
||||
*/
|
||||
private String rewriteDomain;
|
||||
|
||||
/**
|
||||
* 是否开放访问 0=否 1=是
|
||||
*/
|
||||
private Integer openVisit;
|
||||
|
||||
/**
|
||||
* 状态 1=启用 2=禁用
|
||||
*/
|
||||
private Integer docStatus;
|
||||
|
||||
/**
|
||||
* 开放文档UUID
|
||||
*/
|
||||
private String shareUuid;
|
||||
|
||||
/**
|
||||
* 开放文档使用说明
|
||||
*/
|
||||
private String shareInstruction;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 是否有效 0=无效 1=有效
|
||||
*/
|
||||
private Integer yn;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.zyplayer.doc.api.controller.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户权限返回值对象
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年12月12日
|
||||
*/
|
||||
@Data
|
||||
public class DocUserAuthVo {
|
||||
|
||||
/**
|
||||
* 权限类型
|
||||
*/
|
||||
private Integer authType;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户编号,用于登录等
|
||||
*/
|
||||
private String userNo;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 性别 0=女 1=男
|
||||
*/
|
||||
private Integer sex;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.zyplayer.doc.api.controller.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* cookie返回值对象
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年8月21日
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class HttpCookieVo {
|
||||
private String name;
|
||||
private String value;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.zyplayer.doc.api.controller.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* header返回值对象
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年8月21日
|
||||
*/
|
||||
@Data
|
||||
public class HttpHeaderVo {
|
||||
private String name;
|
||||
private String value;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
package com.zyplayer.doc.api.controller.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 代理请求结果
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
@Data
|
||||
public class ProxyRequestResultVo {
|
||||
private List<HttpCookieVo> cookies;
|
||||
private List<HttpHeaderVo> headers;
|
||||
private Integer status;
|
||||
private Long useTime;
|
||||
private Integer contentLength;
|
||||
private String data;
|
||||
private String errorMsg;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
package com.zyplayer.doc.api.controller.vo;
|
||||
|
||||
import com.google.common.collect.ComparisonChain;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* swagger资源信息
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class SwaggerResourceVo implements Comparable<SwaggerResourceVo> {
|
||||
private String name;
|
||||
private String url;
|
||||
private String swaggerVersion;
|
||||
private String rewriteDomain;
|
||||
|
||||
@Override
|
||||
public int compareTo(SwaggerResourceVo other) {
|
||||
return ComparisonChain.start().compare(this.swaggerVersion, other.swaggerVersion).compare(this.name, other.name).result();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.zyplayer.doc.api.framework.config;
|
||||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 开启api接口文档模块注解
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Configuration
|
||||
@ComponentScan(basePackages = {
|
||||
"com.zyplayer.doc.api",
|
||||
})
|
||||
public @interface EnableDocApi {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.zyplayer.doc.api.framework.utils;
|
||||
|
||||
/**
|
||||
* swagger文档工具类
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
public class SwaggerDocUtil {
|
||||
|
||||
public static String replaceSwaggerResources(String docUrl) {
|
||||
int htmlIndex = docUrl.indexOf("/swagger-ui.html");
|
||||
if (htmlIndex > 0) {
|
||||
docUrl = docUrl.substring(0, htmlIndex) + "/swagger-resources";
|
||||
}
|
||||
return docUrl;
|
||||
}
|
||||
|
||||
public static boolean isSwaggerResources(String docUrl) {
|
||||
return docUrl.contains("/swagger-resources");
|
||||
}
|
||||
|
||||
public static String getSwaggerResourceDomain(String docUrl) {
|
||||
int index = docUrl.indexOf("/swagger-resources");
|
||||
if (index >= 0) {
|
||||
return docUrl.substring(0, index);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String getV2ApiDocsDomain(String docUrl) {
|
||||
int index = docUrl.indexOf("/v2/api-docs");
|
||||
if (index >= 0) {
|
||||
return docUrl.substring(0, index);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String getDomainHost(String domain) {
|
||||
domain = domain.replace("http://", "");
|
||||
domain = domain.replace("https://", "");
|
||||
int index = domain.indexOf("/");
|
||||
if (index >= 0) {
|
||||
return domain.substring(0, index);
|
||||
}
|
||||
return domain;
|
||||
}
|
||||
|
||||
public static boolean isSwaggerLocation(String docUrl) {
|
||||
return docUrl.contains("/v2/api-docs");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,251 @@
|
||||
package com.zyplayer.doc.api.service;
|
||||
|
||||
import cn.hutool.core.io.resource.BytesResource;
|
||||
import cn.hutool.core.io.resource.MultiResource;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.http.Method;
|
||||
import com.zyplayer.doc.api.controller.param.ProxyRequestParam;
|
||||
import com.zyplayer.doc.api.controller.vo.HttpCookieVo;
|
||||
import com.zyplayer.doc.api.controller.vo.HttpHeaderVo;
|
||||
import com.zyplayer.doc.api.controller.vo.ProxyRequestResultVo;
|
||||
import com.zyplayer.doc.api.framework.utils.SwaggerDocUtil;
|
||||
import com.zyplayer.doc.core.exception.ConfirmException;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiGlobalParam;
|
||||
import com.zyplayer.doc.data.service.manage.ApiGlobalParamService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.HttpCookie;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* swagger请求服务
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
@Service
|
||||
public class SwaggerHttpRequestService {
|
||||
private static Logger logger = LoggerFactory.getLogger(SwaggerHttpRequestService.class);
|
||||
|
||||
@Resource
|
||||
private ApiGlobalParamService apiGlobalParamService;
|
||||
|
||||
private static final Map<String, Method> requestMethodMap = Stream.of(Method.values()).collect(Collectors.toMap(val -> val.name().toLowerCase(), val -> val));
|
||||
|
||||
List<String> domainHeaderKeys = Arrays.asList("referer", "origin");
|
||||
List<String> needRequestHeaderKeys = Arrays.asList("user-agent");
|
||||
|
||||
/**
|
||||
* 请求真实的swagger文档内容
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
public String requestSwaggerUrl(HttpServletRequest request, Long docId, String docUrl, String docDomain) {
|
||||
List<ApiGlobalParam> globalParamList = apiGlobalParamService.getGlobalParamList(docId);
|
||||
Map<String, Object> globalFormParamMap = globalParamList.stream().filter(item -> Objects.equals(item.getParamType(), 1))
|
||||
.collect(Collectors.toMap(ApiGlobalParam::getParamKey, ApiGlobalParam::getParamValue, (val1, val2) -> val1));
|
||||
Map<String, String> globalHeaderParamMap = globalParamList.stream().filter(item -> Objects.equals(item.getParamType(), 2))
|
||||
.collect(Collectors.toMap(ApiGlobalParam::getParamKey, ApiGlobalParam::getParamValue, (val1, val2) -> val1));
|
||||
Map<String, String> globalCookieParamMap = globalParamList.stream().filter(item -> Objects.equals(item.getParamType(), 3))
|
||||
.collect(Collectors.toMap(ApiGlobalParam::getParamKey, ApiGlobalParam::getParamValue, (val1, val2) -> val1));
|
||||
Map<String, String> requestHeaders = this.getHttpHeader(request, globalHeaderParamMap);
|
||||
if (StringUtils.isNotBlank(docDomain)) {
|
||||
domainHeaderKeys.forEach(key -> requestHeaders.put(key, docDomain));
|
||||
requestHeaders.put("host", SwaggerDocUtil.getDomainHost(docDomain));
|
||||
}
|
||||
// 执行请求
|
||||
String resultStr = HttpRequest.get(docUrl)
|
||||
.form(globalFormParamMap)
|
||||
.addHeaders(requestHeaders)
|
||||
.header("Accept", "application/json, text/javascript, */*; q=0.01")
|
||||
.cookie(this.getHttpCookie(request, globalCookieParamMap, null))
|
||||
.timeout(10000).execute().body();
|
||||
return resultStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行代理请求
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
public void proxyDownload(HttpServletRequest request, HttpServletResponse response, ProxyRequestParam requestParam) {
|
||||
try {
|
||||
HttpResponse httpResponse = this.getHttpResponse(request, requestParam);
|
||||
Map<String, List<String>> responseHeaders = httpResponse.headers();
|
||||
if (MapUtils.isNotEmpty(responseHeaders)) {
|
||||
for (Map.Entry<String, List<String>> httpHeader : responseHeaders.entrySet()) {
|
||||
response.addHeader(httpHeader.getKey(), String.join(";", httpHeader.getValue()));
|
||||
}
|
||||
}
|
||||
httpResponse.writeBody(response.getOutputStream(), true, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行代理请求
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
public ProxyRequestResultVo proxyRequest(HttpServletRequest request, ProxyRequestParam requestParam) {
|
||||
ProxyRequestResultVo resultVo = new ProxyRequestResultVo();
|
||||
long startTime = System.currentTimeMillis();
|
||||
try {
|
||||
HttpResponse httpResponse = getHttpResponse(request, requestParam);
|
||||
resultVo.setData(httpResponse.body());
|
||||
resultVo.setStatus(httpResponse.getStatus());
|
||||
resultVo.setContentLength(httpResponse.bodyBytes().length);
|
||||
// 设置返回的cookies
|
||||
List<HttpCookie> responseCookies = httpResponse.getCookies();
|
||||
if (CollectionUtils.isNotEmpty(responseCookies)) {
|
||||
resultVo.setCookies(responseCookies.stream().map(val -> new HttpCookieVo(val.getName(), val.getValue())).collect(Collectors.toList()));
|
||||
}
|
||||
// 设置返回的headers
|
||||
Map<String, List<String>> responseHeaders = httpResponse.headers();
|
||||
if (MapUtils.isNotEmpty(responseHeaders)) {
|
||||
List<HttpHeaderVo> headerList = new ArrayList<>(responseHeaders.size());
|
||||
for (Map.Entry<String, List<String>> httpHeader : responseHeaders.entrySet()) {
|
||||
HttpHeaderVo vo = new HttpHeaderVo();
|
||||
vo.setName(httpHeader.getKey());
|
||||
vo.setValue(String.join(";", httpHeader.getValue()));
|
||||
headerList.add(vo);
|
||||
}
|
||||
resultVo.setHeaders(headerList);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
resultVo.setErrorMsg(e.getMessage());
|
||||
}
|
||||
resultVo.setUseTime(System.currentTimeMillis() - startTime);
|
||||
return resultVo;
|
||||
}
|
||||
|
||||
private HttpResponse getHttpResponse(HttpServletRequest request, ProxyRequestParam requestParam) {
|
||||
// 执行请求
|
||||
Method method = requestMethodMap.get(requestParam.getMethod());
|
||||
if (method == null) {
|
||||
throw new ConfirmException("不支持的请求方式:" + requestParam.getMethod());
|
||||
}
|
||||
HttpRequest httpRequest = HttpUtil.createRequest(method, requestParam.getUrl());
|
||||
// header获取
|
||||
Map<String, String> headerParam = new HashMap<>();
|
||||
requestParam.getHeaderParamData().forEach(item -> headerParam.put(item.getCode(), item.getValue()));
|
||||
Map<String, String> requestHeaders = this.getHttpHeader(request, headerParam);
|
||||
if (StringUtils.isNotBlank(requestParam.getHost())) {
|
||||
domainHeaderKeys.forEach(key -> requestHeaders.put(key, requestParam.getHost()));
|
||||
requestHeaders.put("host", SwaggerDocUtil.getDomainHost(requestParam.getHost()));
|
||||
}
|
||||
// http自带参数
|
||||
httpRequest.addHeaders(requestHeaders);
|
||||
// 用户输入的参数
|
||||
requestParam.getFormParamData().forEach(data -> httpRequest.form(data.getCode(), data.getValue()));
|
||||
requestParam.getFormEncodeParamData().forEach(data -> httpRequest.form(data.getCode(), data.getValue()));
|
||||
// 文件参数
|
||||
if (request instanceof StandardMultipartHttpServletRequest) {
|
||||
StandardMultipartHttpServletRequest multipartRequest = (StandardMultipartHttpServletRequest) request;
|
||||
Iterator<String> fileNames = multipartRequest.getFileNames();
|
||||
while (fileNames.hasNext()) {
|
||||
String fileName = fileNames.next();
|
||||
String originKey = fileName.replace("_file_", "");
|
||||
List<MultipartFile> fileList = multipartRequest.getFiles(fileName);
|
||||
try {
|
||||
if (fileList.size() > 1) {
|
||||
MultiResource multiResource = new MultiResource();
|
||||
for (MultipartFile file : fileList) {
|
||||
multiResource.add(new BytesResource(file.getBytes(), file.getOriginalFilename()));
|
||||
}
|
||||
httpRequest.form(originKey, multiResource);
|
||||
} else if (fileList.size() > 0) {
|
||||
MultipartFile multipartFile = fileList.get(0);
|
||||
httpRequest.form(originKey, multipartFile.getBytes(), multipartFile.getOriginalFilename());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error("读取上传的文件失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
// cookie参数
|
||||
Map<String, String> cookieParam = new HashMap<>();
|
||||
String headerCookie = headerParam.getOrDefault("Cookie", headerParam.get("cookie"));
|
||||
requestParam.getCookieParamData().forEach(item -> cookieParam.put(item.getCode(), item.getValue()));
|
||||
httpRequest.cookie(this.getHttpCookie(request, cookieParam, headerCookie));
|
||||
if (StringUtils.isNotBlank(requestParam.getBodyParam())) {
|
||||
httpRequest.body(requestParam.getBodyParam());
|
||||
}
|
||||
// 强制设置类型,貌似不用刻意设置,如果写的application/json,参数是表单,传过去收不到值,先注释这个
|
||||
// if (StringUtils.isNotBlank(requestParam.getContentType())) {
|
||||
// httpRequest.contentType(requestParam.getContentType());
|
||||
// }
|
||||
// 执行请求
|
||||
return httpRequest.timeout(10000).execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取http的cookie
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
private List<HttpCookie> getHttpCookie(HttpServletRequest request, Map<String, String> globalCookieParamMap, String headerCookie) {
|
||||
List<HttpCookie> httpCookies = new LinkedList<>();
|
||||
if (request.getCookies() != null) {
|
||||
for (Cookie cookie : request.getCookies()) {
|
||||
httpCookies.add(new HttpCookie(cookie.getName(), cookie.getValue()));
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(headerCookie)) {
|
||||
Arrays.stream(headerCookie.split(";")).map(String::trim).forEach(cookie -> {
|
||||
String[] cookieArr = StringUtils.split(cookie, "=", 2);
|
||||
if (ArrayUtils.getLength(cookieArr) == 2) {
|
||||
httpCookies.add(new HttpCookie(cookieArr[0], cookieArr[1]));
|
||||
}
|
||||
});
|
||||
}
|
||||
if (MapUtils.isNotEmpty(globalCookieParamMap)) {
|
||||
globalCookieParamMap.forEach((key, value) -> httpCookies.add(new HttpCookie(key, value)));
|
||||
}
|
||||
return httpCookies;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取http的header
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
private Map<String, String> getHttpHeader(HttpServletRequest request, Map<String, String> globalHeaderParamMap) {
|
||||
Map<String, String> headerParamMap = new HashMap<>();
|
||||
Enumeration<String> headerNames = request.getHeaderNames();
|
||||
while (headerNames.hasMoreElements()) {
|
||||
String headerName = StringUtils.lowerCase(headerNames.nextElement());
|
||||
if (needRequestHeaderKeys.contains(headerName)) {
|
||||
headerParamMap.put(headerName, request.getHeader(headerName));
|
||||
}
|
||||
}
|
||||
if (MapUtils.isNotEmpty(globalHeaderParamMap)) {
|
||||
headerParamMap.putAll(globalHeaderParamMap);
|
||||
}
|
||||
return headerParamMap;
|
||||
}
|
||||
}
|
||||
BIN
zyplayer-doc-api/src/main/resources/dist/api-logo.png
vendored
Normal file
BIN
zyplayer-doc-api/src/main/resources/dist/api-logo.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.7 KiB |
4
zyplayer-doc-api/src/main/resources/dist/assets/ApiRequest.8325ac99.js
vendored
Normal file
4
zyplayer-doc-api/src/main/resources/dist/assets/ApiRequest.8325ac99.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-api/src/main/resources/dist/assets/DocContent.6ae67ca3.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/DocContent.6ae67ca3.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-api/src/main/resources/dist/assets/DocContent.e32babf7.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/DocContent.e32babf7.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-api/src/main/resources/dist/assets/DocInfo.83ac2ae1.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/DocInfo.83ac2ae1.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import{u as S,a9 as D,r as i,o as t,c as l,w as o,a as n,m as s,t as c,b as p,F as f,k as r,e as m,d as w}from"./vendor.160e93e4.js";import{m as M}from"./index.755e9586.js";import{_ as B}from"./main.0fecd54d.js";const C={setup(){const _=S(),A=D(()=>_.state.openApiDoc),u=D(()=>_.state.openApiDoc.info),e=D(()=>_.state.openApiMethodStatistic);return{openApiDoc:A,openApiDocInfo:u,openApiMethodStatistic:e,getDescription:I=>M.exports.markdownIt.render(I||"")}}},N=["href"],V=["href"],j=["href"],L=["innerHTML"],O={key:1,style:{"text-align":"center"}};function T(_,A,u,e,v,I){const a=i("a-form-item"),h=i("a-divider"),b=i("a-statistic"),k=i("a-card"),y=i("a-col"),g=i("a-row"),x=i("a-form");return t(),l(k,null,{default:o(()=>[e.openApiDocInfo?(t(),l(x,{key:0,"label-col":{span:4},"wrapper-col":{span:20}},{default:o(()=>[n(a,{label:"\u6807\u9898"},{default:o(()=>[s(c(e.openApiDocInfo.title),1)]),_:1}),n(a,{label:"\u7248\u672C"},{default:o(()=>[s(c(e.openApiDocInfo.version),1)]),_:1}),e.openApiDocInfo.contact?(t(),l(a,{key:0,label:"\u4F5C\u8005"},{default:o(()=>[e.openApiDocInfo.contact.name?(t(),p(f,{key:0},[s(c(e.openApiDocInfo.contact.name),1)],64)):r("",!0),e.openApiDocInfo.contact.email?(t(),p(f,{key:1},[n(h,{type:"vertical"}),s(c(e.openApiDocInfo.contact.email),1)],64)):r("",!0),e.openApiDocInfo.contact.url?(t(),p(f,{key:2},[n(h,{type:"vertical"}),m("a",{href:e.openApiDocInfo.contact.url,target:"_blank"},c(e.openApiDocInfo.contact.url),9,N)],64)):r("",!0)]),_:1})):r("",!0),n(a,{label:"host"},{default:o(()=>[s(c(e.openApiDoc.host),1)]),_:1}),e.openApiDocInfo.license?(t(),l(a,{key:1,label:"\u8BB8\u53EF\u8BC1"},{default:o(()=>[m("a",{href:e.openApiDocInfo.license.url,target:"_blank"},c(e.openApiDocInfo.license.name),9,V)]),_:1})):r("",!0),e.openApiDocInfo.termsOfService?(t(),l(a,{key:2,label:"\u670D\u52A1\u6761\u6B3E"},{default:o(()=>[m("a",{href:e.openApiDocInfo.termsOfService,target:"_blank"},c(e.openApiDocInfo.termsOfService),9,j)]),_:1})):r("",!0),n(a,{label:"\u6587\u6863\u8BF4\u660E"},{default:o(()=>[m("div",{class:"markdown-body",innerHTML:e.getDescription(e.openApiDocInfo.description)},null,8,L)]),_:1}),n(a,{label:"\u63A5\u53E3\u7EDF\u8BA1"},{default:o(()=>[n(g,{gutter:[16,16]},{default:o(()=>[(t(),p(f,null,w(["get","post","put","delete","head","patch","options","trace","total"],d=>(t(),p(f,null,[e.openApiMethodStatistic[d]?(t(),l(y,{key:0,span:6},{default:o(()=>[n(k,{size:"small"},{default:o(()=>[n(b,{title:d==="total"?"\u603B\u8BA1":d.toUpperCase()+"\u65B9\u6CD5",value:e.openApiMethodStatistic[d],suffix:"\u4E2A"},null,8,["title","value"])]),_:2},1024)]),_:2},1024)):r("",!0)],64))),64))]),_:1})]),_:1})]),_:1})):(t(),p("div",O,"\u6682\u65E0\u6587\u6863\u4FE1\u606F\uFF0C\u8BF7\u5148\u9009\u62E9\u6587\u6863"))]),_:1})}var z=B(C,[["render",T]]);export{z as default};
|
||||
1
zyplayer-doc-api/src/main/resources/dist/assets/DocInfo.e121194e.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/DocInfo.e121194e.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import{u as S,a9 as w,r as c,o as a,c as l,w as t,a as o,m as g,t as n,b as i,F as f,k as s,e as m,d as M}from"./vendor.160e93e4.js";import{m as B}from"./index.755e9586.js";import{_ as C}from"./main.0fecd54d.js";const N={setup(){const _=S(),D=w(()=>_.state.swaggerDoc),u=w(()=>_.state.swaggerDoc.info),e=w(()=>_.state.swaggerMethodStatistic);return{swaggerDoc:D,swaggerDocInfo:u,swaggerMethodStatistic:e,getDescription:I=>B.exports.markdownIt.render(I||"")}}},V=["href"],j=["href"],L=["href"],O=["innerHTML"],T={key:1,style:{"text-align":"center"}};function E(_,D,u,e,p,I){const r=c("a-form-item"),h=c("a-divider"),v=c("a-statistic"),k=c("a-card"),b=c("a-col"),y=c("a-row"),x=c("a-form");return a(),l(k,null,{default:t(()=>[e.swaggerDocInfo?(a(),l(x,{key:0,"label-col":{span:4},"wrapper-col":{span:20}},{default:t(()=>[o(r,{label:"\u6807\u9898"},{default:t(()=>[g(n(e.swaggerDocInfo.title),1)]),_:1}),o(r,{label:"\u7248\u672C"},{default:t(()=>[g(n(e.swaggerDocInfo.version),1)]),_:1}),e.swaggerDocInfo.contact?(a(),l(r,{key:0,label:"\u4F5C\u8005"},{default:t(()=>[e.swaggerDocInfo.contact.name?(a(),i(f,{key:0},[g(n(e.swaggerDocInfo.contact.name),1)],64)):s("",!0),e.swaggerDocInfo.contact.email?(a(),i(f,{key:1},[o(h,{type:"vertical"}),g(n(e.swaggerDocInfo.contact.email),1)],64)):s("",!0),e.swaggerDocInfo.contact.url?(a(),i(f,{key:2},[o(h,{type:"vertical"}),m("a",{href:e.swaggerDocInfo.contact.url,target:"_blank"},n(e.swaggerDocInfo.contact.url),9,V)],64)):s("",!0)]),_:1})):s("",!0),o(r,{label:"host"},{default:t(()=>[g(n(e.swaggerDoc.host),1)]),_:1}),e.swaggerDocInfo.license?(a(),l(r,{key:1,label:"\u8BB8\u53EF\u8BC1"},{default:t(()=>[m("a",{href:e.swaggerDocInfo.license.url,target:"_blank"},n(e.swaggerDocInfo.license.name),9,j)]),_:1})):s("",!0),e.swaggerDocInfo.termsOfService?(a(),l(r,{key:2,label:"\u670D\u52A1\u6761\u6B3E"},{default:t(()=>[m("a",{href:e.swaggerDocInfo.termsOfService,target:"_blank"},n(e.swaggerDocInfo.termsOfService),9,L)]),_:1})):s("",!0),o(r,{label:"\u6587\u6863\u8BF4\u660E"},{default:t(()=>[m("div",{class:"markdown-body",innerHTML:e.getDescription(e.swaggerDocInfo.description)},null,8,O)]),_:1}),o(r,{label:"\u63A5\u53E3\u7EDF\u8BA1"},{default:t(()=>[o(y,{gutter:[16,16]},{default:t(()=>[(a(),i(f,null,M(["get","post","put","delete","head","patch","options","trace","total"],d=>(a(),i(f,null,[e.swaggerMethodStatistic[d]?(a(),l(b,{key:0,span:6},{default:t(()=>[o(k,{size:"small"},{default:t(()=>[o(v,{title:d==="total"?"\u603B\u8BA1":d.toUpperCase()+"\u65B9\u6CD5",value:e.swaggerMethodStatistic[d],suffix:"\u4E2A"},null,8,["title","value"])]),_:2},1024)]),_:2},1024)):s("",!0)],64))),64))]),_:1})]),_:1})]),_:1})):(a(),i("div",T,"\u6682\u65E0\u6587\u6863\u4FE1\u606F\uFF0C\u8BF7\u5148\u9009\u62E9\u6587\u6863"))]),_:1})}var U=C(N,[["render",E]]);export{U as default};
|
||||
15
zyplayer-doc-api/src/main/resources/dist/assets/DocManage.f08ba4c7.js
vendored
Normal file
15
zyplayer-doc-api/src/main/resources/dist/assets/DocManage.f08ba4c7.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-api/src/main/resources/dist/assets/DocView.0da7b07d.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/DocView.0da7b07d.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import{v as L,u as y,y as a,W as j,r as g,o as h,c as v,w as D,B as k,e as x}from"./vendor.160e93e4.js";import{D as I,s as _}from"./DocContent.e32babf7.js";import{m as M}from"./index.755e9586.js";import{_ as q}from"./main.0fecd54d.js";import"./logUtil.0b911694.js";const S={components:{DocContent:I},setup(){const r=L(),s=y();let m=a("doc"),t=a([]),n=a([]),c=a({url:"",description:"",method:"",consumes:"",produces:""}),o=a(!1),i=0,l;const u=()=>{let P=r.query.path+"."+r.query.method;if(Object.keys(s.state.swaggerUrlMethodMap).length<=0){console.log("\u6587\u6863\u5C1A\u672A\u52A0\u8F7D\uFF0C\u7B49\u5F85\u52A0\u8F7D\u5B8C\u6210"),l||(l=setInterval(()=>{if(o.value||i++>50){clearInterval(l);return}Object.keys(s.state.swaggerUrlMethodMap).length>0&&(console.log("\u6587\u6863\u5185\u5BB9\u6539\u53D8\uFF0C\u91CD\u65B0\u52A0\u8F7D\u6587\u6863"),u())},1e3));return}let e=s.state.swaggerUrlMethodMap[P];if(!e){k.error("\u6CA1\u6709\u627E\u5230\u5BF9\u5E94\u7684\u6587\u6863");return}o.value=!0,s.commit("addTableName",{key:r.fullPath,val:e.summary});let d="",p="";e.consumes&&e.consumes.length>0&&(d=e.consumes.join(" ")),e.produces&&e.produces.length>0&&(p=e.produces.join(" "));let w=M.exports.markdownIt.render(e.description||e.summary||"");c.value={url:e.url,description:w,method:e.method||"",consumes:d,produces:p};let f=s.state.swaggerDefinitions;t.value=_.getRequestParamList(e.parameters,f),n.value=_.getResponseParamList(e.responses,f)};return j(()=>{u()}),{docInfoShow:c,activePage:m,changePage:()=>{},isLoadSuccess:o,requestParamList:t,responseParamList:n}}},b=x("div",{style:{padding:"20px 0",height:"100px"}},null,-1);function C(r,s,m,t,n,c){const o=g("DocContent"),i=g("a-spin");return t.isLoadSuccess?(h(),v(o,{key:0,docInfoShow:t.docInfoShow,requestParamList:t.requestParamList,responseParamList:t.responseParamList},null,8,["docInfoShow","requestParamList","responseParamList"])):(h(),v(i,{key:1,tip:"\u6587\u6863\u6570\u636E\u52A0\u8F7D\u4E2D..."},{default:D(()=>[b]),_:1}))}var V=q(S,[["render",C]]);export{V as default};
|
||||
4
zyplayer-doc-api/src/main/resources/dist/assets/DocView.679586ac.js
vendored
Normal file
4
zyplayer-doc-api/src/main/resources/dist/assets/DocView.679586ac.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
zyplayer-doc-api/src/main/resources/dist/assets/DocView.6da7dd05.js
vendored
Normal file
4
zyplayer-doc-api/src/main/resources/dist/assets/DocView.6da7dd05.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-api/src/main/resources/dist/assets/DocView.accb18db.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/DocView.accb18db.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import{v as y,u as j,y as n,W as k,r as h,o as g,c as v,w,B as x,e as D}from"./vendor.160e93e4.js";import{D as I,o as _}from"./DocContent.6ae67ca3.js";import{m as M}from"./index.755e9586.js";import{_ as q}from"./main.0fecd54d.js";import"./logUtil.0b911694.js";const C={components:{DocContent:I},setup(){const a=y(),t=j();let p=n("doc"),o=n([]),r=n([]),i=n({url:"",description:"",method:"",consumes:"",produces:""}),s=n(!1),c=0,l;const m=()=>{let P=a.query.path+"."+a.query.method;if(Object.keys(t.state.openApiUrlMethodMap).length<=0){console.log("\u6587\u6863\u5C1A\u672A\u52A0\u8F7D\uFF0C\u7B49\u5F85\u52A0\u8F7D\u5B8C\u6210"),l||(l=setInterval(()=>{if(s.value||c++>50){clearInterval(l);return}Object.keys(t.state.openApiUrlMethodMap).length>0&&(console.log("\u6587\u6863\u5185\u5BB9\u6539\u53D8\uFF0C\u91CD\u65B0\u52A0\u8F7D\u6587\u6863"),m())},1e3));return}let e=t.state.openApiUrlMethodMap[P];if(!e){x.error("\u6CA1\u6709\u627E\u5230\u5BF9\u5E94\u7684\u6587\u6863");return}s.value=!0,t.commit("addTableName",{key:a.fullPath,val:e.summary});let u="",d="";e.consumes&&e.consumes.length>0&&(u=e.consumes.join(" ")),e.produces&&e.produces.length>0&&(d=e.produces.join(" "));let L=M.exports.markdownIt.render(e.description||e.summary||"");i.value={url:e.url,description:L,method:e.method||"",consumes:u,produces:d};let f=t.state.openApiComponents;o.value=_.getRequestParamList(e.parameters,f),r.value=_.getResponseParamList(e.responses,f)};return k(()=>{m()}),{docInfoShow:i,activePage:p,changePage:()=>{},isLoadSuccess:s,requestParamList:o,responseParamList:r}}},S=D("div",{style:{padding:"20px 0",height:"100px"}},null,-1);function A(a,t,p,o,r,i){const s=h("DocContent"),c=h("a-spin");return o.isLoadSuccess?(g(),v(s,{key:0,docInfoShow:o.docInfoShow,requestParamList:o.requestParamList,responseParamList:o.responseParamList},null,8,["docInfoShow","requestParamList","responseParamList"])):(g(),v(c,{key:1,tip:"\u6587\u6863\u6570\u636E\u52A0\u8F7D\u4E2D..."},{default:w(()=>[S]),_:1}))}var T=q(C,[["render",A]]);export{T as default};
|
||||
1
zyplayer-doc-api/src/main/resources/dist/assets/EditGlobalParam.a64c5c0b.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/EditGlobalParam.a64c5c0b.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var K=Object.defineProperty;var I=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var B=(s,e,a)=>e in s?K(s,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):s[e]=a,x=(s,e)=>{for(var a in e||(e={}))N.call(e,a)&&B(s,a,e[a]);if(I)for(var a of I(e))O.call(e,a)&&B(s,a,e[a]);return s};import{z as V}from"./custom.05b2559c.js";import{P as S,a4 as U,R as j,u as A,y as L,W as F,r as m,o as l,b as u,e as z,a as d,w as n,F as f,c as k,t as G,k as b,B as R,m as c}from"./vendor.160e93e4.js";import{_ as H}from"./main.0fecd54d.js";const q={components:{PlusOutlined:S,SearchOutlined:U,ReloadOutlined:j},props:{dynamicParam:{type:Object,required:!0}},setup(s){const e=A();let a=L([]),t=L(!1);const h=async()=>{i.value={},t.value=!0,V.docApiGlobalParamList(s.dynamicParam).then(o=>{setTimeout(()=>t.value=!1,500),a.value=o.data||[],e.commit("setGlobalParamOnChange",a.value,s.dynamicParam.id)})};let i=L({}),D=L();const p=()=>{i.value.isEdit&&v(i.value);let o={isEdit:!0,paramType:1};a.value.unshift(o),i.value=o,setTimeout(()=>{let r=document.getElementsByClassName("ant-table-body")[0];r.scrollTop=0},0)},P=o=>{i.value.isEdit&&v(i.value),o.isEdit=!0,i.value=x({},o)},v=o=>{o.isEdit=!1,o.id?a.value.forEach(r=>r.isEdit=!1):a.value=a.value.filter(r=>r!==o),i.value={}},E=o=>{if(!i.value.paramKey||!i.value.paramValue){R.error("\u53C2\u6570\u540D\u6216\u53C2\u6570\u503C\u4E0D\u80FD\u4E3A\u7A7A");return}let r=x(x({},s.dynamicParam),i.value);V.docApiGlobalParamUpdate(r).then(w=>{o.isEdit=!1,h()})},T=async o=>{V.docApiGlobalParamUpdate({id:o.id,yn:0}).then(r=>{h()})};return F(()=>{h()}),{docList:a,docListLoading:t,docEdit:i,tableRef:D,searchDocList:h,deleteDoc:T,editDoc:P,saveEditDoc:E,cancelEditDoc:v,addDocLine:p,docListColumns:[{title:"\u53C2\u6570\u540D\u79F0",dataIndex:"paramKey",width:250},{title:"\u53C2\u6570\u503C",dataIndex:"paramValue"},{title:"\u53C2\u6570\u4F4D\u7F6E",dataIndex:"paramType",width:120},{title:"\u64CD\u4F5C",dataIndex:"operation",fixed:"right",width:170}]}}},M={style:{"margin-bottom":"10px","text-align":"right"}},W=c(" \u5237\u65B0"),J=c(" \u65B0\u5EFA"),Q={key:1},X={key:1},Y=c("Form"),Z=c("Header"),$=c("Cookie"),ee=c("Form"),ae=c("Header"),te=c("Cookie"),oe=c("\u53D6\u6D88"),ne=c("\u4FDD\u5B58"),le=c("\u7F16\u8F91"),ie=c("\u5220\u9664");function de(s,e,a,t,h,i){const D=m("reload-outlined"),p=m("a-button"),P=m("plus-outlined"),v=m("a-input"),E=m("a-select-option"),T=m("a-select"),o=m("a-tag"),r=m("a-popconfirm"),w=m("a-table");return l(),u(f,null,[z("div",M,[d(p,{onClick:t.searchDocList,type:"primary"},{icon:n(()=>[d(D)]),default:n(()=>[W]),_:1},8,["onClick"]),d(p,{onClick:t.addDocLine},{icon:n(()=>[d(P)]),default:n(()=>[J]),_:1},8,["onClick"])]),d(w,{dataSource:t.docList,columns:t.docListColumns,size:"middle",id:"paramTable",loading:t.docListLoading,pagination:!1,scroll:{x:1e3,y:"calc(100vh - 240px)"}},{bodyCell:n(({column:g,text:C,record:y})=>[g.dataIndex==="paramKey"?(l(),u(f,{key:0},[y.isEdit?(l(),k(v,{key:0,placeholder:"\u8BF7\u8F93\u5165\u53C2\u6570\u540D\u79F0",value:t.docEdit.paramKey,"onUpdate:value":e[0]||(e[0]=_=>t.docEdit.paramKey=_)},null,8,["value"])):(l(),u("span",Q,G(C),1))],64)):b("",!0),g.dataIndex==="paramValue"?(l(),u(f,{key:1},[y.isEdit?(l(),k(v,{key:0,rows:1,placeholder:"\u8BF7\u8F93\u5165\u53C2\u6570\u503C",value:t.docEdit.paramValue,"onUpdate:value":e[1]||(e[1]=_=>t.docEdit.paramValue=_)},null,8,["value"])):(l(),u("span",X,G(C),1))],64)):b("",!0),g.dataIndex==="paramType"?(l(),u(f,{key:2},[y.isEdit?(l(),k(T,{key:0,placeholder:"\u53C2\u6570\u4F4D\u7F6E",value:t.docEdit.paramType,"onUpdate:value":e[2]||(e[2]=_=>t.docEdit.paramType=_),style:{width:"110px"}},{default:n(()=>[d(E,{value:1},{default:n(()=>[Y]),_:1}),d(E,{value:2},{default:n(()=>[Z]),_:1}),d(E,{value:3},{default:n(()=>[$]),_:1})]),_:1},8,["value"])):(l(),u(f,{key:1},[C===1?(l(),k(o,{key:0,color:"green"},{default:n(()=>[ee]),_:1})):C===2?(l(),k(o,{key:1,color:"pink"},{default:n(()=>[ae]),_:1})):C===3?(l(),k(o,{key:2,color:"pink"},{default:n(()=>[te]),_:1})):b("",!0)],64))],64)):b("",!0),g.dataIndex==="operation"?(l(),u(f,{key:3},[y.isEdit?(l(),u(f,{key:0},[d(p,{type:"link",onClick:_=>t.cancelEditDoc(y)},{default:n(()=>[oe]),_:2},1032,["onClick"]),d(p,{type:"link",onClick:_=>t.saveEditDoc(y)},{default:n(()=>[ne]),_:2},1032,["onClick"])],64)):(l(),u(f,{key:1},[d(p,{type:"link",onClick:_=>t.editDoc(y)},{default:n(()=>[le]),_:2},1032,["onClick"]),d(r,{title:"\u786E\u5B9A\u8981\u5220\u9664\u5417\uFF1F",onConfirm:_=>t.deleteDoc(y)},{default:n(()=>[d(p,{type:"link",danger:""},{default:n(()=>[ie]),_:1})]),_:2},1032,["onConfirm"])],64))],64)):b("",!0)]),_:1},8,["dataSource","columns","loading","scroll"])],64)}var _e=H(q,[["render",de]]);export{_e as E};
|
||||
6
zyplayer-doc-api/src/main/resources/dist/assets/GlobalLayout.7d22d912.js
vendored
Normal file
6
zyplayer-doc-api/src/main/resources/dist/assets/GlobalLayout.7d22d912.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-api/src/main/resources/dist/assets/GlobalLayout.af9a87d7.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/GlobalLayout.af9a87d7.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-api/src/main/resources/dist/assets/GlobalParam.18079a4b.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/GlobalParam.18079a4b.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import"./custom.05b2559c.js";import{E as a}from"./EditGlobalParam.a64c5c0b.js";import{_ as r}from"./main.0fecd54d.js";import{r as t,o as e,c}from"./vendor.160e93e4.js";const s={components:{EditGlobalParam:a},setup(){return{}}};function m(n,p,d,l,i,_){const o=t("EditGlobalParam");return e(),c(o,{"dynamic-param":{docId:0}})}var G=r(s,[["render",m]]);export{G as default};
|
||||
1
zyplayer-doc-api/src/main/resources/dist/assets/SettingView.733ff161.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/SettingView.733ff161.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import{_ as e}from"./main.0fecd54d.js";import{o as t,b as o}from"./vendor.160e93e4.js";const n={name:"SettingView",components:{},data(){return{}},computed:{},mounted(){},methods:{}};function r(a,s,c,d,m,i){return t(),o("div",null," \u5C55\u793A\u914D\u7F6E\u9875\u9762 ")}var f=e(n,[["render",r]]);export{f as default};
|
||||
1
zyplayer-doc-api/src/main/resources/dist/assets/ShareHome.c25a5730.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/ShareHome.c25a5730.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import{u as p,y as g,W as f,N as x,o as i,b as l,e as _,F as w,d as L,af as N,ag as C,t as I,a9 as S,r as m,a as v,w as u,c as H,k as A}from"./vendor.160e93e4.js";import{m as T}from"./index.755e9586.js";import{_ as y}from"./main.0fecd54d.js";const D={props:{heading:{type:Array,default:[]}},setup(r){const s=p();let a=g("100px");f(()=>{window.onresize=()=>{n()},setTimeout(()=>{n()},100)}),x(s.getters.getLeftAsideWidth,()=>{n()});let e=g();const n=()=>{a.value=window.getComputedStyle(e.value,null).width};return{navigationRef:e,navigationWidth:a,headingItemClick:t=>{t.node.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"})}}}},b={class:"navigation"},W={ref:"navigationRef",style:{display:"inline-block",width:"100%",height:"1px"}},B=["onClick"];function M(r,s,a,e,n,c){return i(),l("div",b,[_("div",W,null,512),_("div",{class:"navigation-heading",style:N({width:e.navigationWidth})},[(i(!0),l(w,null,L(a.heading,t=>(i(),l("div",{class:C("heading-item heading-"+t.level),onClick:o=>e.headingItemClick(t)},I(t.text),11,B))),256))],4)])}var R=y(D,[["render",M]]);const V={components:{Navigation:R},setup(){const r=p(),s=S(()=>r.state.apiDoc);let a=g();x(r.getters.getApiDoc,()=>{setTimeout(()=>{c(".share-instruction")},100)});const e=t=>T.exports.markdownIt.render(t||"");let n=g([]);const c=t=>{if(!document.querySelector(t))return[];let o=document.querySelector(t).querySelectorAll("h1,h2,h3,h4,h5,h6");if(o.length<=0)return[];let d=[];o.forEach(h=>{let k=h.innerHTML.replace(/^\s+/g,"").replace(/\s+$/g,"").replace(/<\/?[^>]+(>|$)/g,"");d.push({node:h,level:parseInt(h.tagName.replace(/[h]/i,""),10),text:k})}),n.value=d};return f(()=>{}),{apiDoc:s,navigationRef:a,navigationList:n,markdownToHtml:e}}},$={key:0},j=["innerHTML"],q={key:1,style:{"text-align":"center"}};function z(r,s,a,e,n,c){const t=m("Navigation"),o=m("a-col"),d=m("a-row");return e.apiDoc.shareInstruction?(i(),l("div",$,[v(d,null,{default:u(()=>[e.navigationList.length>0?(i(),H(o,{key:0,xs:0,sm:4,md:4,lg:6,xl:6},{default:u(()=>[v(t,{ref:"navigationRef",heading:e.navigationList},null,8,["heading"])]),_:1})):A("",!0),v(o,{xs:24,sm:e.navigationList.length>0?20:24,md:e.navigationList.length>0?20:24,lg:e.navigationList.length>0?18:24,xl:e.navigationList.length>0?18:24},{default:u(()=>[_("div",{class:"markdown-body share-instruction",innerHTML:e.markdownToHtml(e.apiDoc.shareInstruction),style:{margin:"0 auto","max-width":"1000px"}},null,8,j)]),_:1},8,["sm","md","lg","xl"])]),_:1})])):(i(),l("div",q,"\u6B22\u8FCE\u8BBF\u95EE\u5F00\u653EAPI\u6587\u6863"))}var G=y(V,[["render",z]]);export{G as default};
|
||||
1
zyplayer-doc-api/src/main/resources/dist/assets/api-logo.84a373cc.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/api-logo.84a373cc.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var E=Object.defineProperty,I=Object.defineProperties;var O=Object.getOwnPropertyDescriptors;var L=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable;var x=(r,e,t)=>e in r?E(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,m=(r,e)=>{for(var t in e||(e={}))b.call(e,t)&&x(r,t,e[t]);if(L)for(var t of L(e))D.call(e,t)&&x(r,t,e[t]);return r},_=(r,e)=>I(r,O(e));import{_ as k}from"./main.0fecd54d.js";import{W as M,y as v,o as j,b as z,e as R}from"./vendor.160e93e4.js";const A=["get","head","post","put","patch","delete","options","trace"];function q(r){let e={},t={},n={},h=r.paths;return h?(Object.keys(h).forEach(o=>{let l=h[o];for(let a of A){if(!l[a]||!l[a].tags)continue;let i=a.toLowerCase();n[i]=(n[i]||0)+1,n.total=(n.total||0)+1,l[a].tags.forEach(f=>{let d=e[f];d||(d=e[f]={});let s=d[o];s||(s=d[o]={});let c=o+"."+a;s[a]=l[a],s[a].path=c,s[a].url=o,s[a].method=a,t[c]=l[a]})}}),{urlMethodMap:t,tagPathMap:e,methodStatistic:n}):{urlMethodMap:t,tagPathMap:e,methodStatistic:n}}function G(r,e,t,n){let h=[],o=1,l=r.tags||[];return l.length<=0&&Object.keys(e).forEach(a=>l.push({name:a})),l.forEach(a=>{let i=1,f=[],d=e[a.name];!d||(Object.keys(d).forEach(s=>{let c=1,p=d[s];Object.keys(p).forEach(y=>{let g=o+"_"+i+"_"+c,u=p[y];if(!$(s,u,t))return;u.treeId=g;let T=u.summary||u.path;f.push({title:T,key:g,isLeaf:!0,method:u.method,query:_(m({},n),{path:u.url,method:u.method})}),c++}),i++}),f.length>0&&h.push({title:a.name,key:o,children:f}),o++)}),[{key:"main",title:r.info.title||"Swagger\u63A5\u53E3\u6587\u6863",children:h}]}function $(r,e,t){if(!t||!r||(r=r.toLowerCase(),t=t.toLowerCase(),r.indexOf(t)>=0))return!0;let n=e.path+e.method+e.summary+e.description+e.tags;return n&&n.toLowerCase().indexOf(t)>=0}const P=["get","head","post","put","patch","delete","options","trace"];function H(r){let e={},t={},n={},h=r.paths;return h?(Object.keys(h).forEach(o=>{let l=h[o];for(let a of P){if(!l[a]||!l[a].tags)continue;let i=a.toLowerCase();n[i]=(n[i]||0)+1,n.total=(n.total||0)+1,l[a].tags.forEach(f=>{let d=e[f];d||(d=e[f]={});let s=d[o];s||(s=d[o]={});let c=o+"."+a;s[a]=l[a],s[a].path=c,s[a].url=o,s[a].method=a,t[c]=l[a]})}}),{urlMethodMap:t,tagPathMap:e,methodStatistic:n}):{urlMethodMap:t,tagPathMap:e,methodStatistic:n}}function J(r,e,t,n){let h=[],o=1,l=r.tags||[];return l.length<=0&&Object.keys(e).forEach(a=>l.push({name:a})),l.forEach(a=>{let i=1,f=[],d=e[a.name];!d||(Object.keys(d).forEach(s=>{let c=1,p=d[s];Object.keys(p).forEach(y=>{let g=o+"_"+i+"_"+c,u=p[y];if(!B(s,u,t))return;u.treeId=g;let T=u.summary||u.path;f.push({title:T,key:g,isLeaf:!0,method:u.method,query:_(m({},n),{path:u.url,method:u.method})}),c++}),i++}),f.length>0&&h.push({title:a.name,key:o,children:f}),o++)}),[{key:"main",title:r.info.title||"OpenApi\u63A5\u53E3\u6587\u6863",children:h}]}function B(r,e,t){if(!t||!r||(r=r.toLowerCase(),t=t.toLowerCase(),r.indexOf(t)>=0))return!0;let n=e.path+e.method+e.summary+e.description+e.tags;return n&&n.toLowerCase().indexOf(t)>=0}function K(r,e,t,n){let h=r[0],o=C(h,e,t,n,1);return[{key:"main",isLeaf:!1,title:h.name||"\u81EA\u5EFAAPI\u63A5\u53E3\u6587\u6863",children:o}]}function C(r,e,t,n,h){let o=[];if(!r)return o;let l=1,a=1;return r.children&&r.children.length>0&&r.children.forEach(i=>{n.originNodeMap[i.nodeId]=i;let f=h+"_"+l+"_"+a;if(i.nodeType===1)o.push({title:i.nodeName,key:f,isLeaf:!0,method:i.method,nodeId:i.nodeId,query:_(m({},t),{nodeId:i.nodeId})}),a++;else{let d=C(i,e,t,n,f),s=U(i,e);(d.length>0||s)&&(o.push({title:i.nodeName,key:f,nodeId:i.nodeId,isLeaf:!1,editing:!1,titleEditing:i.nodeName,children:d}),a++)}}),l++,o}function U(r,e){if(!e||!r)return!0;e=e.toLowerCase();let t=r.name;return t&&t.toLowerCase().indexOf(e)>=0}const w={emits:["update:value","change"],setup(r,{emit:e}){M(()=>{o()});let t=v(300),n=v(),h=v();const o=()=>{let l=n.value,a=h.value;l.onmousedown=i=>{let f=i.clientX;return l.style.background="#ccc",a.style.background="#aaa",l.left=l.offsetLeft,document.onmousemove=d=>{let s=d.clientX,c=f-s;(c<0&&t.value<600||c>0&&t.value>300)&&(f=s,t.value-=c,t.value<300&&(t.value=300),e("update:value",t.value),e("change",t.value))},document.onmouseup=()=>{l.style.background="#fafafa",a.style.background="#ccc",document.onmousemove=null,document.onmouseup=null},!1}};return{leftAsideWidth:t,leftResizeRef:n,leftResizeBarRef:h}}},F={ref:"leftResizeRef",class:"left-resize"},S={ref:"leftResizeBarRef"};function X(r,e,t,n,h,o){return j(),z("div",F,[R("i",S,"...",512)],512)}var Q=k(w,[["render",X],["__scopeId","data-v-33303c20"]]),Y="assets/api-logo.952f0c92.png";export{Q as L,Y as _,q as a,H as b,J as c,K as d,G as g};
|
||||
BIN
zyplayer-doc-api/src/main/resources/dist/assets/api-logo.952f0c92.png
vendored
Normal file
BIN
zyplayer-doc-api/src/main/resources/dist/assets/api-logo.952f0c92.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.7 KiB |
5
zyplayer-doc-api/src/main/resources/dist/assets/custom.05b2559c.js
vendored
Normal file
5
zyplayer-doc-api/src/main/resources/dist/assets/custom.05b2559c.js
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
zyplayer-doc-api/src/main/resources/dist/assets/fontello.0286fb90.eot
vendored
Normal file
BIN
zyplayer-doc-api/src/main/resources/dist/assets/fontello.0286fb90.eot
vendored
Normal file
Binary file not shown.
BIN
zyplayer-doc-api/src/main/resources/dist/assets/fontello.37711755.ttf
vendored
Normal file
BIN
zyplayer-doc-api/src/main/resources/dist/assets/fontello.37711755.ttf
vendored
Normal file
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
BIN
zyplayer-doc-api/src/main/resources/dist/assets/fontello.8aa3e26e.woff
vendored
Normal file
BIN
zyplayer-doc-api/src/main/resources/dist/assets/fontello.8aa3e26e.woff
vendored
Normal file
Binary file not shown.
BIN
zyplayer-doc-api/src/main/resources/dist/assets/fontello.febc4ea8.woff2
vendored
Normal file
BIN
zyplayer-doc-api/src/main/resources/dist/assets/fontello.febc4ea8.woff2
vendored
Normal file
Binary file not shown.
1116
zyplayer-doc-api/src/main/resources/dist/assets/index.3d03ec9c.js
vendored
Normal file
1116
zyplayer-doc-api/src/main/resources/dist/assets/index.3d03ec9c.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1697
zyplayer-doc-api/src/main/resources/dist/assets/index.755e9586.js
vendored
Normal file
1697
zyplayer-doc-api/src/main/resources/dist/assets/index.755e9586.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-api/src/main/resources/dist/assets/logUtil.0b911694.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/logUtil.0b911694.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import{B as s}from"./vendor.160e93e4.js";var g={log(o,e,l){console.log(o+"-\u9047\u5230\u672A\u5904\u7406\u7684\u7C7B\u578B\uFF0C\u8BF7\u8054\u7CFB\u5F00\u53D1\u4EBA\u5458\u4FEE\u6539\uFF1A"+e,l)},logMessage(o,e,l){console.log(o+"-\u9047\u5230\u672A\u5904\u7406\u7684\u7C7B\u578B\uFF0C\u8BF7\u8054\u7CFB\u5F00\u53D1\u4EBA\u5458\u4FEE\u6539\uFF1A"+e,l),s.error(o+"-\u9047\u5230\u672A\u5904\u7406\u7684\u7C7B\u578B\uFF0C\u8BF7\u8054\u7CFB\u5F00\u53D1\u4EBA\u5458\u4FEE\u6539\uFF1A"+e)}};export{g as l};
|
||||
1
zyplayer-doc-api/src/main/resources/dist/assets/main.0fecd54d.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/main.0fecd54d.js
vendored
Normal file
File diff suppressed because one or more lines are too long
8
zyplayer-doc-api/src/main/resources/dist/assets/style.9e577f5e.css
vendored
Normal file
8
zyplayer-doc-api/src/main/resources/dist/assets/style.9e577f5e.css
vendored
Normal file
File diff suppressed because one or more lines are too long
10
zyplayer-doc-api/src/main/resources/dist/assets/unitConvert.73e95b27.js
vendored
Normal file
10
zyplayer-doc-api/src/main/resources/dist/assets/unitConvert.73e95b27.js
vendored
Normal file
File diff suppressed because one or more lines are too long
161
zyplayer-doc-api/src/main/resources/dist/assets/vendor.160e93e4.js
vendored
Normal file
161
zyplayer-doc-api/src/main/resources/dist/assets/vendor.160e93e4.js
vendored
Normal file
File diff suppressed because one or more lines are too long
16
zyplayer-doc-api/src/main/resources/dist/doc-api.html
vendored
Normal file
16
zyplayer-doc-api/src/main/resources/dist/doc-api.html
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="api-logo.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>API文档管理</title>
|
||||
<script type="module" crossorigin src="assets/main.0fecd54d.js"></script>
|
||||
<link rel="modulepreload" href="assets/vendor.160e93e4.js">
|
||||
<link rel="stylesheet" href="assets/style.9e577f5e.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -7,9 +7,9 @@
|
||||
<artifactId>zyplayer-doc-core</artifactId>
|
||||
|
||||
<parent>
|
||||
<groupId>org.dromara</groupId>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.1.5</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@@ -33,10 +33,6 @@
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-collections4</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-core</artifactId>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.core.annotation;
|
||||
package com.zyplayer.doc.core.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.core.enums;
|
||||
package com.zyplayer.doc.core.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -13,9 +13,9 @@ public enum PageFileSource {
|
||||
PASTE_FILES(2, "页面粘贴的图片或文件"),
|
||||
;
|
||||
@Getter
|
||||
private final Integer source;
|
||||
private Integer source;
|
||||
@Getter
|
||||
private final String desc;
|
||||
private String desc;
|
||||
|
||||
PageFileSource(Integer source, String desc) {
|
||||
this.source = source;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.core.enums;
|
||||
package com.zyplayer.doc.core.enums;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -15,8 +15,8 @@ public enum SystemConfigEnum {
|
||||
DOC_SYSTEM_VERSION("doc_system_version", "系统当前的版本号"),
|
||||
;
|
||||
|
||||
private final String key;
|
||||
private final String desc;
|
||||
private String key;
|
||||
private String desc;
|
||||
|
||||
SystemConfigEnum(String key, String desc) {
|
||||
this.key = key;
|
||||
@@ -1,33 +1,33 @@
|
||||
package org.dromara.zyplayer.core.exception;
|
||||
|
||||
/**
|
||||
* 前端提示异常
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年12月8日
|
||||
*/
|
||||
public class ConfirmException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = -7084066605197111614L;
|
||||
|
||||
public ConfirmException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ConfirmException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
|
||||
public ConfirmException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public ConfirmException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ConfirmException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
}
|
||||
package com.zyplayer.doc.core.exception;
|
||||
|
||||
/**
|
||||
* 前端提示异常
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年12月8日
|
||||
*/
|
||||
public class ConfirmException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = -7084066605197111614L;
|
||||
|
||||
public ConfirmException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ConfirmException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
|
||||
public ConfirmException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public ConfirmException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ConfirmException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.core.json;
|
||||
package com.zyplayer.doc.core.json;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
@@ -18,7 +18,7 @@ import java.util.Objects;
|
||||
* @since 2018年8月21日
|
||||
*/
|
||||
public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
private static final SerializeConfig mapping = new SerializeConfig();
|
||||
private static SerializeConfig mapping = new SerializeConfig();
|
||||
|
||||
static {
|
||||
mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss"));
|
||||
@@ -134,7 +134,7 @@ public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
* @since 2018年8月7日
|
||||
*/
|
||||
public static <T> DocResponseJson<T> warn(String errMsg) {
|
||||
return new DocResponseJson<>(300, errMsg);
|
||||
return new DocResponseJson<T>(300, errMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,7 +145,7 @@ public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
* @since 2018年8月7日
|
||||
*/
|
||||
public static <T> DocResponseJson<T> error(String errMsg) {
|
||||
return new DocResponseJson<>(500, errMsg);
|
||||
return new DocResponseJson<T>(500, errMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,7 +156,7 @@ public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
* @since 2018年8月7日
|
||||
*/
|
||||
public static <T> DocResponseJson<T> failure(int errCode, String errMsg) {
|
||||
return new DocResponseJson<>(errCode, errMsg);
|
||||
return new DocResponseJson<T>(errCode, errMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.core.json;
|
||||
package com.zyplayer.doc.core.json;
|
||||
|
||||
/**
|
||||
* http静态资源定义
|
||||
@@ -1,11 +1,11 @@
|
||||
package org.dromara.zyplayer.core.json;
|
||||
|
||||
/**
|
||||
* json视图
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年8月21日
|
||||
*/
|
||||
public interface ResponseJson<T> {
|
||||
|
||||
}
|
||||
package com.zyplayer.doc.core.json;
|
||||
|
||||
/**
|
||||
* json视图
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年8月21日
|
||||
*/
|
||||
public interface ResponseJson<T> {
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.core.util;
|
||||
package com.zyplayer.doc.core.util;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.core.util;
|
||||
package com.zyplayer.doc.core.util;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -10,14 +10,13 @@ import java.util.List;
|
||||
* @since 2021-06-06
|
||||
*/
|
||||
public class ZyplayerDocVersion {
|
||||
public static final String version = "1.1.6";
|
||||
public static final String version = "1.1.5";
|
||||
|
||||
/**
|
||||
* 每次升级必须添加一条记录,用于执行它的升级SQL
|
||||
*/
|
||||
public static final List<UpgradeInfo> versionUpgrade = new LinkedList<UpgradeInfo>() {{
|
||||
add(new UpgradeInfo("1.1.6", true));
|
||||
add(new UpgradeInfo("1.1.5", false));
|
||||
add(new UpgradeInfo("1.1.5", true));
|
||||
add(new UpgradeInfo("1.1.4", true));
|
||||
add(new UpgradeInfo("1.1.3", false));
|
||||
add(new UpgradeInfo("1.1.2", true));
|
||||
@@ -7,9 +7,9 @@
|
||||
<artifactId>zyplayer-doc-data</artifactId>
|
||||
|
||||
<parent>
|
||||
<groupId>org.dromara</groupId>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.1.5</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@@ -101,7 +101,7 @@
|
||||
<!-- </exclusions>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
package org.dromara.zyplayer.data.config;
|
||||
package com.zyplayer.doc.data.config;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||
import org.dromara.zyplayer.data.repository.support.interceptor.SqlLogInterceptor;
|
||||
import org.dromara.zyplayer.data.utils.DruidDataSourceUtil;
|
||||
import com.zyplayer.doc.data.repository.support.interceptor.SqlLogInterceptor;
|
||||
import com.zyplayer.doc.data.utils.DruidDataSourceUtil;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import org.apache.ibatis.mapping.DatabaseIdProvider;
|
||||
import org.apache.ibatis.mapping.VendorDatabaseIdProvider;
|
||||
|
||||
import java.util.Properties;
|
||||
import javax.annotation.Resource;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@@ -32,7 +29,7 @@ public class MybatisPlusConfig {
|
||||
*/
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
@MapperScan(value = "org.dromara.zyplayer.data.repository.manage.mapper", sqlSessionFactoryRef = "manageSqlSessionFactory")
|
||||
@MapperScan(value = "com.zyplayer.doc.data.repository.manage.mapper", sqlSessionFactoryRef = "manageSqlSessionFactory")
|
||||
static class ManageMybatisDbConfig {
|
||||
|
||||
@Value("${zyplayer.doc.manage.datasource.driverClassName}")
|
||||
@@ -54,21 +51,9 @@ public class MybatisPlusConfig {
|
||||
@Bean(name = "manageSqlSessionFactory")
|
||||
public MybatisSqlSessionFactoryBean manageSqlSessionFactory() throws Exception {
|
||||
MybatisSqlSessionFactoryBean sqlSessionFactoryBean = new MybatisSqlSessionFactoryBean();
|
||||
DatabaseIdProvider databaseIdProvider = new VendorDatabaseIdProvider();
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("SQL Server", "sqlserver");
|
||||
properties.setProperty("DB2", "db2");
|
||||
properties.setProperty("Oracle", "oracle");
|
||||
properties.setProperty("MySQL", "mysql");
|
||||
properties.setProperty("PostgreSQL", "postgresql");
|
||||
properties.setProperty("Derby", "derby");
|
||||
properties.setProperty("HSQL", "hsqldb");
|
||||
properties.setProperty("H2", "h2");
|
||||
databaseIdProvider.setProperties(properties);
|
||||
sqlSessionFactoryBean.setDatabaseIdProvider(databaseIdProvider);
|
||||
sqlSessionFactoryBean.setDataSource(manageDatasource());
|
||||
sqlSessionFactoryBean.setPlugins(new SqlLogInterceptor(), paginationInterceptor);
|
||||
|
||||
|
||||
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||
sqlSessionFactoryBean.setMapperLocations(resolver.getResources("classpath:/mapper/manage/*Mapper.xml"));
|
||||
return sqlSessionFactoryBean;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.config.security;
|
||||
package com.zyplayer.doc.data.config.security;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -15,7 +15,6 @@ public class DocUserDetails {
|
||||
private Long userId;
|
||||
private String username;
|
||||
private String password;
|
||||
private String accessToken;
|
||||
private boolean enabled;
|
||||
private List<UserAuthInfo> userAuthList;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.dromara.zyplayer.data.config.security;
|
||||
package com.zyplayer.doc.data.config.security;
|
||||
|
||||
import org.dromara.zyplayer.data.utils.CachePrefix;
|
||||
import org.dromara.zyplayer.data.utils.CacheUtil;
|
||||
import com.zyplayer.doc.data.utils.CachePrefix;
|
||||
import com.zyplayer.doc.data.utils.CacheUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -69,7 +69,6 @@ public class DocUserUtil {
|
||||
* 设置当前用户
|
||||
*/
|
||||
public static void setCurrentUser(String accessToken, DocUserDetails docUser) {
|
||||
docUser.setAccessToken(accessToken);
|
||||
DOC_USER_DETAILS.set(docUser);
|
||||
CacheUtil.put(accessToken, docUser);
|
||||
CacheUtil.put(CachePrefix.LOGIN_USER_ID_TOKEN + docUser.getUserId(), accessToken);
|
||||
@@ -1,8 +1,8 @@
|
||||
package org.dromara.zyplayer.data.config.security;
|
||||
package com.zyplayer.doc.data.config.security;
|
||||
|
||||
import org.dromara.zyplayer.data.repository.manage.entity.UserAuth;
|
||||
import org.dromara.zyplayer.data.repository.support.consts.DocSysModuleType;
|
||||
import org.dromara.zyplayer.data.repository.support.consts.DocSysType;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.UserAuth;
|
||||
import com.zyplayer.doc.data.repository.support.consts.DocSysModuleType;
|
||||
import com.zyplayer.doc.data.repository.support.consts.DocSysType;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.dromara.zyplayer.data.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user