|
@@ -119,7 +119,7 @@ public class AuthorizationController {
|
|
|
public void redirect(String code, String state, HttpServletResponse response) throws Exception {
|
|
public void redirect(String code, String state, HttpServletResponse response) throws Exception {
|
|
|
AuthToken token = weChatService.getAuthToken(code,weChatConfig.getAppid());
|
|
AuthToken token = weChatService.getAuthToken(code,weChatConfig.getAppid());
|
|
|
|
|
|
|
|
- baseRedirect(token, state, response);
|
|
|
|
|
|
|
+ baseRedirect(token, state, User.RegisterEnv.wx, response);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -219,7 +219,7 @@ public class AuthorizationController {
|
|
|
|
|
|
|
|
AuthToken token = weChatService.getAuthToken(code, wxOpenPlatYHLXLoginConfig.getAppId());
|
|
AuthToken token = weChatService.getAuthToken(code, wxOpenPlatYHLXLoginConfig.getAppId());
|
|
|
//重定向
|
|
//重定向
|
|
|
- baseRedirect(token, state, response);
|
|
|
|
|
|
|
+ baseRedirect(token, state, User.RegisterEnv.pc, response);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -418,7 +418,7 @@ public class AuthorizationController {
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(loginPhoneRep);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(loginPhoneRep);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public void baseRedirect(AuthToken token, String state, HttpServletResponse response) throws Exception {
|
|
|
|
|
|
|
+ public void baseRedirect(AuthToken token, String state, User.RegisterEnv registerEnv, HttpServletResponse response) throws Exception {
|
|
|
// 根据openid 与 access_token 获取用户信息
|
|
// 根据openid 与 access_token 获取用户信息
|
|
|
GzhOAuth2UserInfo userinfo = weChatService.getUserInfo(token.getAccessToken(), token.getOpenid());
|
|
GzhOAuth2UserInfo userinfo = weChatService.getUserInfo(token.getAccessToken(), token.getOpenid());
|
|
|
|
|
|
|
@@ -426,7 +426,7 @@ public class AuthorizationController {
|
|
|
String json = Codec.DoBase64.custom().setData(state).decodeAsText();
|
|
String json = Codec.DoBase64.custom().setData(state).decodeAsText();
|
|
|
AuthRedirect re = Jsons.parseObject(json, AuthRedirect.class);
|
|
AuthRedirect re = Jsons.parseObject(json, AuthRedirect.class);
|
|
|
//保存用户信息
|
|
//保存用户信息
|
|
|
- User user = userService.saveAuth(userinfo, re.getSharedId(), re.getDsType(), re.getPid());
|
|
|
|
|
|
|
+ User user = userService.saveAuth(userinfo, re.getSharedId(), re.getDsType(), re.getPid(), registerEnv);
|
|
|
if (user == null) {
|
|
if (user == null) {
|
|
|
throw BusinessRuntimeException.getInstance("系统错误,请重新授权");
|
|
throw BusinessRuntimeException.getInstance("系统错误,请重新授权");
|
|
|
}
|
|
}
|