mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2025-01-03 17:42:20 +08:00
feat:网关整合sentinel
This commit is contained in:
parent
78ca7c7ab6
commit
b9ef5c5155
@ -118,7 +118,8 @@ youlai-mall
|
||||
|
||||
1. **启动`Nacos`服务**
|
||||
|
||||
IDEA下方工具栏点击Terminal终端命令行,执行`cd youlai-registry/nacos/bin`命令切换到Nacos的启动脚本文件夹下,然后执行`startup -m standalone`命令启动Nacos服务;
|
||||
IDEA下方工具栏点击Terminal终端命令行,执行`cd youlai-middleware/nacos/bin`命令切换到Nacos的启动脚本文件夹下,然后执行`startup -m
|
||||
standalone`命令启动Nacos服务;
|
||||
|
||||
2. **启动平台基础服务**
|
||||
|
||||
|
@ -18,6 +18,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import org.apache.logging.log4j.util.Strings;
|
||||
@ -43,7 +44,7 @@ public class AuthController {
|
||||
|
||||
private TokenEndpoint tokenEndpoint;
|
||||
|
||||
@ApiOperation(value = "OAuth2认证",notes = "login")
|
||||
@ApiOperation(value = "OAuth2认证", notes = "login")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "grant_type", defaultValue = "password", value = "授权模式", required = true),
|
||||
@ApiImplicitParam(name = "client_id", defaultValue = "client", value = "Oauth2客户端ID", required = true),
|
||||
@ -88,6 +89,7 @@ public class AuthController {
|
||||
private UmsMemberFeignService memberFeignService;
|
||||
private PasswordEncoder passwordEncoder;
|
||||
|
||||
@SneakyThrows
|
||||
public OAuth2AccessToken handleForWxAuth(Principal principal, Map<String, String> parameters) throws HttpRequestMethodNotSupportedException {
|
||||
|
||||
String code = parameters.get("code");
|
||||
@ -97,12 +99,8 @@ public class AuthController {
|
||||
}
|
||||
|
||||
WxMaJscode2SessionResult session = null;
|
||||
try {
|
||||
// 根据授权code获取微信用户信息
|
||||
session = wxService.getUserService().getSessionInfo(code);
|
||||
} catch (WxErrorException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String openid = session.getOpenid();
|
||||
String sessionKey = session.getSessionKey();
|
||||
|
||||
|
@ -54,11 +54,15 @@
|
||||
<keepAliveDuration>5 minutes</keepAliveDuration>
|
||||
</appender>
|
||||
|
||||
<!-- additivity="true" 默认是true 会向上传递至root -->
|
||||
<logger name="com.youlai.common.web.aspect.LoginLogAspect" level="INFO" additivity="true">
|
||||
<!-- additivity 默认是true,标识该logger的日志会在root的appender再打印一次 -->
|
||||
<logger name="com.youlai.common.web.aspect.LoginLogAspect" level="INFO" additivity="false">
|
||||
<appender-ref ref="LOGIN_LOGSTASH"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.alibaba.nacos.client.naming" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
|
||||
<!-- 根logger -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
|
@ -14,6 +14,7 @@ spring:
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
file-extension: yaml
|
||||
sentinel:
|
||||
enabled: false
|
||||
eager: true
|
||||
transport:
|
||||
dashboard: localhost:8080
|
||||
@ -34,6 +35,6 @@ spring:
|
||||
groupId: SENTINEL_GROUP
|
||||
data-type: json
|
||||
rule-type: gw-api-group
|
||||
enabled: false
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user