From 179c4d64313c9b7572778da4aaaf6c6584fe457d Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期二, 20 五月 2025 23:48:08 +0800
Subject: [PATCH] 修改文件上传类型限制

---
 springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/config/SwaggerConfig.java |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/config/SwaggerConfig.java b/springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/config/SwaggerConfig.java
new file mode 100644
index 0000000..7cf907f
--- /dev/null
+++ b/springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/config/SwaggerConfig.java
@@ -0,0 +1,60 @@
+package com.panzhihua.zuul.config;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.springframework.cloud.netflix.zuul.filters.RouteLocator;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+
+import springfox.documentation.swagger.web.SwaggerResource;
+import springfox.documentation.swagger.web.SwaggerResourcesProvider;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+/**
+ * @program: springcloud_k8s_panzhihuazhihuishequ
+ * @description: swagger
+ * @author: huang.hongfa weixin hhf9596 qq 959656820
+ * @create: 2020-11-26 16:57
+ **/
+@Configuration
+@EnableSwagger2
+@Primary
+public class SwaggerConfig implements SwaggerResourcesProvider {
+
+    // RouteLocator可以根据zuul配置的路由列表获取服务
+    private final RouteLocator routeLocator;
+
+    private String[] ids =
+        new String[] {"huacheng-appletsbackstage", "huacheng-applets", "huacheng-communitybackstage", "huacheng-shopbackstage",
+                "huacheng-gridbackstage", "huacheng-gridapp","huacheng-union-applets","huacheng-sangeshenbian"};
+
+    public SwaggerConfig(RouteLocator routeLocator) {
+        this.routeLocator = routeLocator;
+    }
+
+    /**
+     * Gets a result.
+     *
+     * @return a result
+     */
+    @Override
+    public List<SwaggerResource> get() {
+        List resources = new ArrayList();
+        Arrays.asList(ids).forEach(id -> {
+            resources.add(swaggerResource(id, MessageFormat.format("/api/{0}/v2/api-docs", id), "1.0"));
+        });
+        return resources;
+    }
+
+    private SwaggerResource swaggerResource(String name, String location, String version) {
+        SwaggerResource swaggerResource = new SwaggerResource();
+        swaggerResource.setName(name);
+        swaggerResource.setLocation(location);
+        swaggerResource.setSwaggerVersion(version);
+        return swaggerResource;
+    }
+
+}

--
Gitblit v1.7.1