swagger支持填入页面地址

This commit is contained in:
暮光:城中城
2019-07-03 22:51:53 +08:00
parent 0214934b1f
commit e3ed105f49
2 changed files with 6 additions and 1 deletions

View File

@@ -306,7 +306,7 @@ public class DubboController {
private List<DubboInfo> getDubboInfoByNacos() {
List<DubboInfo> providerList = new LinkedList<>();
// 获取所有的服务列表
String serviceListStr = HttpUtil.get(nacosUrl + "/v1/ns/catalog/serviceList?startPg=1&pgSize=100000");
String serviceListStr = HttpUtil.get(nacosUrl + "/v1/ns/catalog/services?withInstances=false&pageNo=1&pageSize=100000");
NacosServiceInfoVo nacosServiceInfoVo = JSON.parseObject(serviceListStr, NacosServiceInfoVo.class);
if (nacosServiceInfoVo == null || nacosServiceInfoVo.getServiceList().isEmpty()) {
return providerList;

View File

@@ -301,6 +301,11 @@ public class MgDocumentController {
*/
@PostMapping(value = "/addSwaggerResources")
public ResponseJson<Object> addSwaggerResources(String resourcesUrl, String rewriteDomainUrl, String oldUrl, Integer openVisit) {
// 总有些人喜欢填这个地址,那就替换来支持下吧
int htmlIndex = resourcesUrl.indexOf("/swagger-ui.html");
if (htmlIndex > 0) {
resourcesUrl = resourcesUrl.substring(0, htmlIndex) + "/swagger-resources";
}
String swaggerResourcesStr = storageService.get(StorageKeys.SWAGGER_RESOURCES_LIST);
// 转成set防止重复
List<SwaggerResourcesInfoVo> resourcesList = new LinkedList<>();