!11 依赖更新

* fixed: cors跨域
* pom依赖更新
* 版本号
This commit is contained in:
白书科技 2024-10-12 05:41:42 +00:00
parent b4647458ba
commit 590642320a
10 changed files with 50 additions and 60 deletions

View File

@ -20,7 +20,7 @@ volumes:
services:
playedu:
# build: .
image: registry.cn-hangzhou.aliyuncs.com/playedu/light:1.7
image: registry.cn-hangzhou.aliyuncs.com/playedu/light:1.8
restart: always
environment:
- DB_HOST=mysql

View File

@ -6,35 +6,32 @@
<parent>
<groupId>xyz.playedu</groupId>
<artifactId>playedu</artifactId>
<version>1.2</version>
<version>1.0</version>
</parent>
<artifactId>playedu-api</artifactId>
<properties>
<java.version>17</java.version>
</properties>
<version>1.9</version>
<dependencies>
<dependency>
<groupId>xyz.playedu</groupId>
<artifactId>playedu-common</artifactId>
<version>1.2</version>
<version>1.0</version>
</dependency>
<dependency>
<groupId>xyz.playedu</groupId>
<artifactId>playedu-system</artifactId>
<version>1.2</version>
<version>1.0</version>
</dependency>
<dependency>
<groupId>xyz.playedu</groupId>
<artifactId>playedu-course</artifactId>
<version>1.2</version>
<version>1.0</version>
</dependency>
<dependency>
<groupId>xyz.playedu</groupId>
<artifactId>playedu-resource</artifactId>
<version>1.2</version>
<version>1.0</version>
</dependency>
</dependencies>
@ -44,7 +41,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.1.2</version>
<version>3.3.4</version>
<executions>
<execution>
<goals>

View File

@ -45,20 +45,13 @@ public class ApiInterceptor implements HandlerInterceptor {
public boolean preHandle(
HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Headers", "*");
response.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
response.setHeader("Access-Control-Max-Age", "86400");
if ("OPTIONS".equals(request.getMethod())) {
response.setStatus(204);
// 返回false意味着整个请求执行到这里结束不会继续乡下执行了
return false;
}
// 当前api的请求路径
String path = request.getRequestURI();
// 白名单过滤 || OPTIONS请求
// 白名单过滤
if (BackendConstant.API_LIMIT_WHITELIST.contains(path)) {
return HandlerInterceptor.super.preHandle(request, response, handler);
}

View File

@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
@Configuration
@Slf4j
@ -38,4 +39,13 @@ public class WebMvcConfig implements WebMvcConfigurer {
registry.addInterceptor(adminInterceptor).addPathPatterns("/backend/**");
registry.addInterceptor(frontInterceptor).addPathPatterns("/api/v1/**");
}
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("*")
.allowedHeaders("*")
.maxAge(1_296_000);
}
}

View File

@ -55,14 +55,14 @@ mybatis-plus:
banner: false
sa-token:
is-print: false
token-name: "Authorization"
timeout: 1296000 #token有效期[单位:秒,默认15天]
is-concurrent: false #限制同时登录
is-share: false
jwt-secret-key: "playeduxyz"
token-prefix: "Bearer"
is-print: false
is-log: true
is-log: false
log-level: "warn"
playedu:

View File

@ -6,8 +6,9 @@
<parent>
<groupId>xyz.playedu</groupId>
<artifactId>playedu</artifactId>
<version>1.2</version>
<version>1.0</version>
</parent>
<artifactId>playedu-common</artifactId>
<version>1.0</version>
</project>

View File

@ -6,21 +6,22 @@
<parent>
<groupId>xyz.playedu</groupId>
<artifactId>playedu</artifactId>
<version>1.2</version>
<version>1.0</version>
</parent>
<artifactId>playedu-course</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>xyz.playedu</groupId>
<artifactId>playedu-common</artifactId>
<version>1.2</version>
<version>1.0</version>
</dependency>
<dependency>
<groupId>xyz.playedu</groupId>
<artifactId>playedu-resource</artifactId>
<version>1.2</version>
<version>1.0</version>
</dependency>
</dependencies>
</project>

View File

@ -6,16 +6,17 @@
<parent>
<groupId>xyz.playedu</groupId>
<artifactId>playedu</artifactId>
<version>1.2</version>
<version>1.0</version>
</parent>
<artifactId>playedu-resource</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>xyz.playedu</groupId>
<artifactId>playedu-common</artifactId>
<version>1.2</version>
<version>1.0</version>
</dependency>
</dependencies>
</project>

View File

@ -6,16 +6,17 @@
<parent>
<groupId>xyz.playedu</groupId>
<artifactId>playedu</artifactId>
<version>1.2</version>
<version>1.0</version>
</parent>
<artifactId>playedu-system</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>xyz.playedu</groupId>
<artifactId>playedu-common</artifactId>
<version>1.2</version>
<version>1.0</version>
</dependency>
</dependencies>
</project>

View File

@ -5,16 +5,16 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.5</version>
<version>3.3.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>xyz.playedu</groupId>
<artifactId>playedu</artifactId>
<version>1.2</version>
<version>1.0</version>
<packaging>pom</packaging>
<name>playedu</name>
<description>playedu</description>
<name>PlayEdu</name>
<description>开源企业内部培训解决方案</description>
<modules>
<module>playedu-api</module>
@ -41,19 +41,13 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
@ -70,14 +64,8 @@
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.3</version>
</dependency>
<!--表单验证 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
<version>3.5.7</version>
</dependency>
<dependency>
@ -102,6 +90,7 @@
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.12.572</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
@ -111,36 +100,33 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-json</artifactId>
<version>5.8.16</version>
<version>5.8.32</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-http</artifactId>
<version>5.8.16</version>
<version>5.8.32</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
<version>5.8.16</version>
<version>5.8.32</version>
</dependency>
<!-- Sa-Token 权限认证在线文档https://sa-token.cc -->
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot3-starter</artifactId>
<version>1.34.0</version>
<version>1.39.0</version>
</dependency>
<!-- Sa-Token 整合 Redis (使用 jackson 序列化方式) -->
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-dao-redis-jackson</artifactId>
<version>1.34.0</version>
<artifactId>sa-token-redis-jackson</artifactId>
<version>1.39.0</version>
</dependency>
<!-- Sa-Token 整合 jwt -->
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-jwt</artifactId>
<version>1.34.0</version>
<version>1.39.0</version>
</dependency>
</dependencies>
@ -149,7 +135,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<version>3.13.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
@ -159,7 +145,7 @@
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.36.0</version>
<version>2.43.0</version>
<configuration>
<java>
<googleJavaFormat>