Commit 360e7575 authored by lee_mingzhu's avatar lee_mingzhu

添加跳转商城具体页面的逻辑

parent 5d17a296
...@@ -173,9 +173,9 @@ public class WeChatController { ...@@ -173,9 +173,9 @@ public class WeChatController {
* @param response * @param response
* @return * @return
*/ */
@RequestMapping("/receiveCode/{key}") @RequestMapping("/receiveCode/{key}/{redirect}")
public void receiveCode(String code, @PathVariable(value = "key") String systemKey, String redirect, HttpServletResponse response) { public void receiveCode(String code, @PathVariable(value = "key") String systemKey, @PathVariable String redirect, HttpServletResponse response) {
LOGGER.info("微信登录:" + systemKey); LOGGER.info("微信登录:redirect{}" + redirect);
// 从code获取token // 从code获取token
Merchant merchant = merchantService.findMerchantByName(systemKey); Merchant merchant = merchantService.findMerchantByName(systemKey);
...@@ -221,15 +221,17 @@ public class WeChatController { ...@@ -221,15 +221,17 @@ public class WeChatController {
} }
private String createUserSession(User user, Merchant merchant, String redirect) { private String createUserSession(User user, Merchant merchant, String redirect) {
if(StringUtils.isEmpty(redirect)) { if(StringUtils.isEmpty(redirect) || "redirect".equals(redirect)) {
LOGGER.info("微信登录: createUserSession:{} merchant is null:", merchant == null); LOGGER.info("微信登录:redirect为null,走正常流程.");
if ("baitiao".equals(merchant.getName())) { if ("baitiao".equals(merchant.getName())) {
return loginInWechatWithSessionCreated(user, merchant, "cashTarget5", Constants.Channel.BAITIAO); return loginInWechatWithSessionCreated(user, merchant, "cashTarget5", Constants.Channel.BAITIAO);
} else { } else {
return loginInWechatWithSessionCreated(user, merchant, "cashTarget4", 1L); return loginInWechatWithSessionCreated(user, merchant, "cashTarget4", 1L);
} }
} else if(redirect.equals("redirect")){ } else if(redirect.equals("local")){
LOGGER.info("微信登录:redirect不为null,创建session跳到指定前端页面.");
AuthBean authBean = sessionService.createSession(Constants.Channel.WECHAT, Constants.Channel.WECHAT, "", user, merchant); AuthBean authBean = sessionService.createSession(Constants.Channel.WECHAT, Constants.Channel.WECHAT, "", user, merchant);
LOGGER.info("微信登录:跳转地址{}", userUIAddr + "/weixin/callback?phoneNo=" + user.getPhoneNo() + "&token=" + authBean.getToken());
return userUIAddr + "/weixin/callback?phoneNo=" + user.getPhoneNo() + "&token=" + authBean.getToken(); return userUIAddr + "/weixin/callback?phoneNo=" + user.getPhoneNo() + "&token=" + authBean.getToken();
} }
return null; return null;
...@@ -253,7 +255,6 @@ public class WeChatController { ...@@ -253,7 +255,6 @@ public class WeChatController {
} }
private String assembleNormalRedirectUrl(Merchant merchant) { private String assembleNormalRedirectUrl(Merchant merchant) {
LOGGER.info("微信登录: assembleNormalRedirectUrl:{} merchant is null:", merchant == null);
if ("baitiao".equals(merchant.getName())) { if ("baitiao".equals(merchant.getName())) {
return userUIAddr + "/landing?key=baitiao&target=cashTarget5&registerFrom=198&channelId=222"; return userUIAddr + "/landing?key=baitiao&target=cashTarget5&registerFrom=198&channelId=222";
} else { } else {
...@@ -262,7 +263,6 @@ public class WeChatController { ...@@ -262,7 +263,6 @@ public class WeChatController {
} }
private String assembleWechatRedirectUrl(Merchant merchant, WechatUserInfo userInfo) { private String assembleWechatRedirectUrl(Merchant merchant, WechatUserInfo userInfo) {
LOGGER.info("微信登录: assembleWechatRedirectUrl:{} merchant is null:", merchant == null);
if ("baitiao".equals(merchant.getName())) { if ("baitiao".equals(merchant.getName())) {
return userUIAddr + "/landing?key=baitiao&target=cashTarget5&registerFrom=198&channelId=222&isWechat=true&openId=" + userInfo.getOpenId(); return userUIAddr + "/landing?key=baitiao&target=cashTarget5&registerFrom=198&channelId=222&isWechat=true&openId=" + userInfo.getOpenId();
} else { } else {
......
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