diff --git a/src/main/java/com/yupi/springbootinit/config/SaTokenConfigure.java b/src/main/java/com/yupi/springbootinit/config/SaTokenConfigure.java index 07edf5b..9869280 100644 --- a/src/main/java/com/yupi/springbootinit/config/SaTokenConfigure.java +++ b/src/main/java/com/yupi/springbootinit/config/SaTokenConfigure.java @@ -10,11 +10,14 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class SaTokenConfigure implements WebMvcConfigurer { + + + @Override public void addInterceptors(InterceptorRegistry registry) { // 注册Sa-Token的拦截器 registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin())) - .addPathPatterns("/**") + .addPathPatterns("/api/**") .excludePathPatterns(getExcludePaths()); } diff --git a/src/main/java/com/yupi/springbootinit/controller/UserController.java b/src/main/java/com/yupi/springbootinit/controller/UserController.java index 5b4b29d..402d705 100644 --- a/src/main/java/com/yupi/springbootinit/controller/UserController.java +++ b/src/main/java/com/yupi/springbootinit/controller/UserController.java @@ -38,7 +38,6 @@ public class UserController { if (user == null) { throw new BusinessException(ErrorCode.USERNAME_OR_PASSWORD_ERROR); } - if (!usersService.isPasswordMatch(usersDTO.getPassword(), user.getPassword())) { throw new BusinessException(ErrorCode.USERNAME_OR_PASSWORD_ERROR); } @@ -49,8 +48,8 @@ public class UserController { if (usersService.isExpired(usersDTO.getTenantId())){ throw new BusinessException(ErrorCode.PACKAGE_EXPIRED); } - if (usersService.checkCrawlRole(user.getId())){ - throw new BusinessException(ErrorCode.NOT_FOUND_ERROR); + if (!usersService.checkCrawlRole(user.getId())){ + throw new BusinessException(ErrorCode.LOGIN_NOW_ALLOWED); } Long second = usersService.getTenantExpiredTime(usersDTO.getTenantId()); SystemUsersVO systemUsersVO = new SystemUsersVO(); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 3111455..ffbb4ce 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -42,7 +42,7 @@ server: mybatis-plus: configuration: map-underscore-to-camel-case: false - log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl + log-impl: org.apache.ibatis.logging.log4j2.Log4j2Impl log-sql: default-executor-type: batch global-config: @@ -108,19 +108,5 @@ sa-token: # 是否输出操作日志 is-log: true - -# security配置,如果使用了Spring security或者satoken需要添加排除路径 - security: - # 排除路径 - excludes: - - /*.html - - /**/*.html - - /**/*.css - - /**/*.js - - /favicon.ico - - /error/** - #swagger文档和knife4j的路径 - - /v3/api-docs/** - - /doc.html/** md5: salt: (-FhqvXO,wMz \ No newline at end of file