diff --git a/.idea/misc.xml b/.idea/misc.xml
index a1d25e0..7b89c3a 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -5,12 +5,8 @@
-
-
-
+
diff --git a/common/service-util/src/main/java/com/atguigu/ssyx/common/config/WebMvcConfiguration.java b/common/service-util/src/main/java/com/atguigu/ssyx/common/config/WebMvcConfiguration.java
index 22208c4..8827deb 100644
--- a/common/service-util/src/main/java/com/atguigu/ssyx/common/config/WebMvcConfiguration.java
+++ b/common/service-util/src/main/java/com/atguigu/ssyx/common/config/WebMvcConfiguration.java
@@ -2,28 +2,10 @@ package com.atguigu.ssyx.common.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
@Slf4j
public class WebMvcConfiguration implements WebMvcConfigurer {
- /**
- * * 解决跨域
- *
- * @param registry 跨域注册表
- */
- @Override
- public void addCorsMappings(CorsRegistry registry) {
- log.info("WebMvcConfiguration===>开始跨域注册表...");
- registry.addMapping("/admin/**")// 添加路径规则
- .allowCredentials(true)// 是否允许在跨域的情况下传递Cookie
- .allowedOrigins("*")// 允许请求来源的域规则
- .allowedMethods("*").allowedHeaders("*");// 允许所有的请求头
- registry.addMapping("/api/**")// 添加路径规则
- .allowCredentials(true)// 是否允许在跨域的情况下传递Cookie
- .allowedOrigins("*")// 允许请求来源的域规则
- .allowedMethods("*").allowedHeaders("*");// 允许所有的请求头
- }
}
\ No newline at end of file
diff --git a/service-gateway/Dockerfile b/service-gateway/Dockerfile
new file mode 100644
index 0000000..ef109ac
--- /dev/null
+++ b/service-gateway/Dockerfile
@@ -0,0 +1,21 @@
+FROM openjdk:17
+MAINTAINER bunny
+
+#系统编码
+ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
+
+# 设置时区,构建镜像时执行的命令
+RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
+RUN echo "Asia/Shanghai" > /etc/timezone
+
+# 设定工作目录
+WORKDIR /home/bunny
+
+# 复制jar包
+COPY target/*.jar /home/bunny/app.jar
+
+#启动容器时的进程
+ENTRYPOINT ["java","-jar","/home/bunny/app.jar"]
+
+#暴露 8080 端口
+EXPOSE 8080
\ No newline at end of file
diff --git a/service-gateway/pom.xml b/service-gateway/pom.xml
new file mode 100644
index 0000000..0a956dd
--- /dev/null
+++ b/service-gateway/pom.xml
@@ -0,0 +1,47 @@
+
+ 4.0.0
+
+ com.atguigu
+ guigu-ssyx-parent
+ 1.0-SNAPSHOT
+
+
+ service-gateway
+ jar
+
+ service-gateway
+ https://maven.apache.org
+
+
+ UTF-8
+
+
+
+
+ com.atguigu
+ service-util
+ 1.0-SNAPSHOT
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-sentinel
+
+
+
+ org.springframework.cloud
+ spring-cloud-loadbalancer
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-gateway
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-discovery
+
+
+
diff --git a/service-gateway/src/main/java/com/atguigu/ssyx/geteway/ServiceGatewayApplication.java b/service-gateway/src/main/java/com/atguigu/ssyx/geteway/ServiceGatewayApplication.java
new file mode 100644
index 0000000..7eed74e
--- /dev/null
+++ b/service-gateway/src/main/java/com/atguigu/ssyx/geteway/ServiceGatewayApplication.java
@@ -0,0 +1,11 @@
+package com.atguigu.ssyx.geteway;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class ServiceGatewayApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(ServiceGatewayApplication.class, args);
+ }
+}
\ No newline at end of file
diff --git a/service-gateway/src/main/java/com/atguigu/ssyx/geteway/config/GateWayCorsConfig.java b/service-gateway/src/main/java/com/atguigu/ssyx/geteway/config/GateWayCorsConfig.java
new file mode 100644
index 0000000..7ba1d65
--- /dev/null
+++ b/service-gateway/src/main/java/com/atguigu/ssyx/geteway/config/GateWayCorsConfig.java
@@ -0,0 +1,29 @@
+package com.atguigu.ssyx.geteway.config;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.reactive.CorsWebFilter;
+import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;
+
+@Configuration
+@Slf4j
+public class GateWayCorsConfig {
+ @Bean
+ protected CorsWebFilter addCorsMappings() {
+ log.info("CorsConfig===>开始跨域注册表...");
+
+ CorsConfiguration config = new CorsConfiguration();
+ // 设置跨域请求地址
+ config.addAllowedMethod("*");
+ config.addAllowedHeader("*");
+ config.addAllowedOrigin("*");
+ config.setAllowCredentials(true);
+
+ UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
+ source.registerCorsConfiguration("/**", config);
+
+ return new CorsWebFilter(source);
+ }
+}
\ No newline at end of file
diff --git a/service-gateway/src/main/java/com/atguigu/ssyx/geteway/controller/IndexController.java b/service-gateway/src/main/java/com/atguigu/ssyx/geteway/controller/IndexController.java
new file mode 100644
index 0000000..02b40f8
--- /dev/null
+++ b/service-gateway/src/main/java/com/atguigu/ssyx/geteway/controller/IndexController.java
@@ -0,0 +1,17 @@
+package com.atguigu.ssyx.geteway.controller;
+
+import com.atguigu.ssyx.common.result.Result;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RequestMapping("/")
+@RestController
+@Slf4j
+public class IndexController {
+ @GetMapping()
+ public Result index() {
+ return Result.success("欢迎访问。。。");
+ }
+}
diff --git a/service-gateway/src/main/resources/application-dev.yml b/service-gateway/src/main/resources/application-dev.yml
new file mode 100644
index 0000000..c6a69d7
--- /dev/null
+++ b/service-gateway/src/main/resources/application-dev.yml
@@ -0,0 +1,8 @@
+server:
+ port: 8200
+
+bunny:
+ nacos:
+ server-addr: z-bunny.cn:8848
+ discovery:
+ namespace: ssyx
\ No newline at end of file
diff --git a/service-gateway/src/main/resources/application.yml b/service-gateway/src/main/resources/application.yml
new file mode 100644
index 0000000..aa8f6fe
--- /dev/null
+++ b/service-gateway/src/main/resources/application.yml
@@ -0,0 +1,82 @@
+server:
+ port: 8200
+
+spring:
+ application:
+ name: server-gateway
+ main:
+ web-application-type: reactive
+ profiles:
+ active: dev
+ cloud:
+ sentinel:
+ log:
+ dir: logs/${spring.application.name}/sentinel
+ nacos:
+ discovery:
+ namespace: ${bunny.nacos.discovery.namespace}
+ server-addr: ${bunny.nacos.server-addr}
+ log-name: logs/${spring.application.name}
+ gateway:
+ discovery:
+ locator:
+ enabled: true
+ routes:
+ - id: service-acl
+ uri: lb://service-acl
+ predicates:
+ - Path=/*/acl/**
+
+ - id: service-sys
+ uri: lb://service-sys
+ predicates:
+ - Path=/*/sys/**
+
+ - id: service-product
+ uri: lb://service-product
+ predicates:
+ - Path=/*/product/**
+
+ - id: service-activity
+ uri: lb://service-activity
+ predicates:
+ - Path=/*/activity/**
+
+ - id: service-order
+ uri: lb://service-order
+ predicates:
+ - Path=/*/order/**
+
+ - id: service-payment
+ uri: lb://service-payment
+ predicates:
+ - Path=/*/payment/**
+
+ - id: service-user
+ uri: lb://service-user
+ predicates:
+ - Path=/*/user/**
+
+ - id: service-search
+ uri: lb://service-search
+ predicates:
+ - Path=/*/search/**
+
+ - id: service-home
+ uri: lb://service-home
+ predicates:
+ - Path=/*/home/**
+
+ - id: service-cart
+ uri: lb://service-cart
+ predicates:
+ - Path=/*/cart/**
+logging:
+ level:
+ com.atguigu.ssyx.acl.mapper: debug
+ com.atguigu.ssyx.acl.controller: info
+ com.atguigu.ssyx.acl.service: info
+ pattern:
+ dateformat: HH:mm:ss:SSS
+ file:
+ path: "logs/${spring.application.name}"
\ No newline at end of file
diff --git a/service-gateway/src/main/resources/banner.txt b/service-gateway/src/main/resources/banner.txt
new file mode 100644
index 0000000..cc77fc2
--- /dev/null
+++ b/service-gateway/src/main/resources/banner.txt
@@ -0,0 +1,16 @@
+-----------------▄██-█▄---------
+-----------------███▄██▄--------
+-----------------███████--------
+-----------------▀███████-------
+-------------------██████▄▄-----
+-------------------█████████▄---
+-------------------██████▄████--
+-------▄███████████████████████-
+-----▄███████████████████████▀--
+---▄██████████████████████------
+---███████████████████████------
+---███████████████████████------
+-▄▄██████████████████████▀------
+-█████████████████▀█████--------
+-▀██████████████▀▀-▀█████▄------
+-------▀▀▀▀▀▀▀▀▀------▀▀▀▀------
\ No newline at end of file
diff --git a/service-gateway/src/main/resources/favicon.ico b/service-gateway/src/main/resources/favicon.ico
new file mode 100644
index 0000000..1ba397c
Binary files /dev/null and b/service-gateway/src/main/resources/favicon.ico differ
diff --git a/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/FileUploadController.java b/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/FileUploadController.java
index c4521da..c45a19d 100644
--- a/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/FileUploadController.java
+++ b/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/FileUploadController.java
@@ -13,7 +13,7 @@ import org.springframework.web.multipart.MultipartFile;
@Api(tags = "文件上传接口")
@RestController
-@RequestMapping("admin/product")
+@RequestMapping("/admin/product")
public class FileUploadController {
@Autowired
private FileUploadService fileUploadService;
diff --git a/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/SkuAttrValueController.java b/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/SkuAttrValueController.java
index c3621f6..a18f928 100644
--- a/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/SkuAttrValueController.java
+++ b/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/SkuAttrValueController.java
@@ -2,7 +2,6 @@ package com.atguigu.ssyx.product.controller;
import org.springframework.web.bind.annotation.RequestMapping;
-
import org.springframework.web.bind.annotation.RestController;
/**
@@ -14,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
* @since 2024-04-03
*/
@RestController
-@RequestMapping("/product/sku-attr-value")
+@RequestMapping("/admin/product/sku-attr-value")
public class SkuAttrValueController {
}
diff --git a/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/SkuImageController.java b/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/SkuImageController.java
index b6f22e7..5632796 100644
--- a/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/SkuImageController.java
+++ b/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/SkuImageController.java
@@ -2,7 +2,6 @@ package com.atguigu.ssyx.product.controller;
import org.springframework.web.bind.annotation.RequestMapping;
-
import org.springframework.web.bind.annotation.RestController;
/**
@@ -14,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
* @since 2024-04-03
*/
@RestController
-@RequestMapping("/product/sku-image")
+@RequestMapping("/admin/product/sku-image")
public class SkuImageController {
}
diff --git a/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/SkuPosterController.java b/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/SkuPosterController.java
index e699c3f..d0f0ccc 100644
--- a/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/SkuPosterController.java
+++ b/service/service-product/src/main/java/com/atguigu/ssyx/product/controller/SkuPosterController.java
@@ -2,7 +2,6 @@ package com.atguigu.ssyx.product.controller;
import org.springframework.web.bind.annotation.RequestMapping;
-
import org.springframework.web.bind.annotation.RestController;
/**
@@ -14,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
* @since 2024-04-03
*/
@RestController
-@RequestMapping("/product/sku-poster")
+@RequestMapping("/admin/product/sku-poster")
public class SkuPosterController {
}