Commit 0ff7cb1d authored by 王亮's avatar 王亮

update previous code.(LoginProperties tenantId)

parent 4af777a0
......@@ -722,7 +722,7 @@ public class UserController implements IBaseController {
} else if (!wechatRelateUserIfNecessary(user, request, appId, tenantId)) {
return JsonResult.buildErrorStateResult("登录时微信关联失败", null);
}
LoginProperties loginProperties = new LoginProperties("", 1, channelId, createdFrom, appChannel, merchant.getId(), merchant.getName(), null);
LoginProperties loginProperties = new LoginProperties("", 1, channelId, createdFrom, appChannel, merchant.getId(), merchant.getName(), tenantId);
AuthBean authBean = sessionService.createSession(user, loginProperties, LoginType.ACCOUNTPASSWORD.ordinal(), tenantId);
if (authBean != null) {
authBean.setRegister(false);
......@@ -808,7 +808,7 @@ public class UserController implements IBaseController {
} else if (!wechatRelateUserIfNecessary(user, request, appId, tenantId)) {
return JsonResult.buildErrorStateResult("登录时微信关联失败", null);
}
LoginProperties loginProperties = new LoginProperties("", 4, channelId, createdFrom, appChannel, merchant.getId(), merchant.getName(), null);
LoginProperties loginProperties = new LoginProperties("", 4, channelId, createdFrom, appChannel, merchant.getId(), merchant.getName(), tenantId);
//尝试解锁
lockIpv4Service.unLockPhone(user.getEncryptedPhoneNo());
......@@ -916,7 +916,7 @@ public class UserController implements IBaseController {
return JsonResult.buildErrorStateResult("未知的连接", null);
}
LoginProperties loginProperties = new LoginProperties("", 4, channelId, createdFrom, appChannel, merchant.getId(), merchant.getName(), null);
LoginProperties loginProperties = new LoginProperties("", 4, channelId, createdFrom, appChannel, merchant.getId(), merchant.getName(), tenantId);
try {
userService.kdspLogout(userId, loginProperties, tenantId);
} catch (Exception e) {
......
......@@ -299,7 +299,7 @@ public class WeChatController implements IBaseController {
}
// 已经关联了用户
// create session, 登进去,该怎么玩怎么玩。
String redirectUrl = createUserSession(user, merchant, redirect, domain, registerFrom);
String redirectUrl = createUserSession(user, merchant, redirect, domain, registerFrom,tenantId);
response.setHeader("Location", redirectUrl);
response.setStatus(HttpStatus.SC_MOVED_PERMANENTLY);
}
......@@ -359,18 +359,18 @@ public class WeChatController implements IBaseController {
receiveCodeWithDefault(code, systemKey, schema, registerFrom, redirect, redirect, response,appId,tenantId);
}
private String createUserSession(User user, Merchant merchant, String redirect, String domain, Long registerFrom) {
private String createUserSession(User user, Merchant merchant, String redirect, String domain, Long registerFrom,Integer tenantId) {
log.info("[WeChatController][createUserSession]微信授权及跳转:user:{},merchant:{},redirect:{},domain:{},registerFrom:{}", user, merchant, redirect, domain, registerFrom);
LoginProperties loginProperties = new LoginProperties("", 4, Constants.Channel.WECHAT, registerFrom, String.valueOf(Constants.Channel.WECHAT), merchant.getId(), merchant.getName(), null);
LoginProperties loginProperties = new LoginProperties("", 4, Constants.Channel.WECHAT, registerFrom, String.valueOf(Constants.Channel.WECHAT), merchant.getId(), merchant.getName(), tenantId);
if (StringUtils.isEmpty(redirect) || Constants.REDIRECT.equals(redirect)) {
log.info("微信登录:redirect为null,走正常流程.");
if (Constants.MERCHANT_BAITIAO.equals(merchant.getName())) {
return loginInWechatWithSessionCreated(user, merchant, "cashTarget5", Constants.Channel.BAITIAO, domain, Constants.Channel.WECHAT);
return loginInWechatWithSessionCreated(user, merchant, "cashTarget5", Constants.Channel.BAITIAO, domain, Constants.Channel.WECHAT,tenantId);
} else if (Constants.MERCHANT_WECHAT_PAY.equals(merchant.getName())) {
AuthBean authBean = sessionService.createSession(user, loginProperties, LoginType.WECHATLOGIN.ordinal(),user.getTenantId());
return domain + "/landing?token=" + authBean.getToken() + "&registerFrom=" + registerFrom + "&channelId=" + Constants.Channel.WECHAT + "&key=" + merchant.getName() + "&target=cashTarget5";
} else {
return loginInWechatWithSessionCreated(user, merchant, "cashTarget4", 1L, domain, registerFrom);
return loginInWechatWithSessionCreated(user, merchant, "cashTarget4", 1L, domain, registerFrom,tenantId);
}
} else if (Constants.LOCAL.equals(redirect)) {
log.info("微信登录:redirect不为null,创建session跳到指定前端页面.");
......@@ -388,8 +388,8 @@ public class WeChatController implements IBaseController {
return null;
}
private String loginInWechatWithSessionCreated(User user, Merchant merchant, String target, Long channelId, String domain, Long registerFrom) {
LoginProperties loginProperties = new LoginProperties("", 4, channelId, registerFrom, String.valueOf(Constants.Channel.WECHAT), merchant.getId(), merchant.getName(), null);
private String loginInWechatWithSessionCreated(User user, Merchant merchant, String target, Long channelId, String domain, Long registerFrom,Integer tenantId) {
LoginProperties loginProperties = new LoginProperties("", 4, channelId, registerFrom, String.valueOf(Constants.Channel.WECHAT), merchant.getId(), merchant.getName(), tenantId);
AuthBean authBean = sessionService.createSession(user, loginProperties, LoginType.WECHATLOGIN.ordinal(),user.getTenantId());
log.info("[WeChatController][loginInWechatWithSessionCreated]微信授权及跳转:user:{},merchant:{},target:{},channelId:{},domain:{},registerFrom:{}", user, merchant, target, channelId, domain, registerFrom);
return domain + "/landing?token=" + authBean.getToken() + "&registerFrom=" + registerFrom + "&channelId=" + channelId + "&key=" + merchant.getName() + "&target=" + target;
......
......@@ -106,7 +106,7 @@ public class AppController implements IBaseController {
if (merchant == null) {
result = JsonResult.buildErrorStateResult("无效的商户", null);
}else{
LoginProperties loginProperties = new LoginProperties("", 4, channelId, registerFrom, appChannel, merchant.getId(), merchant.getName(), null);
LoginProperties loginProperties = new LoginProperties("", 4, channelId, registerFrom, appChannel, merchant.getId(), merchant.getName(), tenantId);
AuthBean bean = sessionService.createSession(user, loginProperties, LoginType.AUTHLOGIN.ordinal(),tenantId);
LoginInfo.LoginContext context = new LoginInfo.LoginContext();
context.setChannelId(channelId);
......@@ -176,7 +176,7 @@ public class AppController implements IBaseController {
return JsonResult.buildErrorStateResult("无效的商户", null);
}
LoginProperties loginProperties = new LoginProperties("", 4, channelId, registerFrom, appChannel, merchant.getId(), merchant.getName(), null);
LoginProperties loginProperties = new LoginProperties("", 4, channelId, registerFrom, appChannel, merchant.getId(), merchant.getName(), tenantId);
AuthBean bean = sessionService.createSession(user, loginProperties, LoginType.SUPERLOGIN.ordinal(),tenantId);
log.info("第三方用户登录成功 [AppController] login --> loginFrom:{}, phoneNo:{},appChannel:{}", registerFrom, phoneNo, appChannel);
return JsonResult.buildSuccessResult("登录成功", bean);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment