Commit dba1c6be authored by hezhen's avatar hezhen

123

parent a50eb4f8
...@@ -56,14 +56,15 @@ public class WeChatH5LoginInterceoptor extends HandlerInterceptorAdapter { ...@@ -56,14 +56,15 @@ public class WeChatH5LoginInterceoptor extends HandlerInterceptorAdapter {
String frontSessionValue = new String(Base64.decode(frontSessionValue1), "utf-8"); String frontSessionValue = new String(Base64.decode(frontSessionValue1), "utf-8");
return true; return true;
} }
String curr_url = request.getRequestURL().toString() /*String curr_url = request.getRequestURL().toString()
+ (StringUtils.isBlank(request.getQueryString()) ? "" : "?" + request.getQueryString()); + (StringUtils.isBlank(request.getQueryString()) ? "" : "?" + request.getQueryString());*/
String curr_url="https://dev.dfangche.com/api/summit/activity/app/unauth/index";
String encrypt_curr_url = Base64.encode(curr_url); String encrypt_curr_url = Base64.encode(curr_url);
String code = request.getParameter("code"); String code = request.getParameter("code");
// 没有code, 则进行网页授权获取code // 没有code, 则进行网页授权获取code
log.info("curr_url=====" + curr_url + "-----code=" + code); log.info("curr_url=====" + curr_url + "-----code=" + code);
if (StringUtils.isBlank(code)) { if (StringUtils.isBlank(code)) {
String redirec_url=url+"?" + WECHAT_AUTOLOGIN_CALLBACKURL_KEY+ "=" + encrypt_curr_url; String redirec_url=curr_url+"?" + WECHAT_AUTOLOGIN_CALLBACKURL_KEY+ "=" + encrypt_curr_url;
String oauth_api=weixinService.getAuthorize(redirec_url); String oauth_api=weixinService.getAuthorize(redirec_url);
log.info("curr_url=====" + curr_url); log.info("curr_url=====" + curr_url);
response.sendRedirect(oauth_api); response.sendRedirect(oauth_api);
......
...@@ -58,7 +58,7 @@ public class WeixinService { ...@@ -58,7 +58,7 @@ public class WeixinService {
String oauth_api = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={APPID}&redirect_uri={REDIRECT_URI}&response_type=code&scope={SCOPE}&state={STATE}#wechat_redirect"; String oauth_api = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={APPID}&redirect_uri={REDIRECT_URI}&response_type=code&scope={SCOPE}&state={STATE}#wechat_redirect";
oauth_api = oauth_api.replace("{APPID}", wy_appid) oauth_api = oauth_api.replace("{APPID}", wy_appid)
.replace("{REDIRECT_URI}", redirec_url) .replace("{REDIRECT_URI}", redirec_url)
.replace("{SCOPE}", "snsapi_base").replace("{STATE}", "state"); .replace("{SCOPE}", "snsapi_userinfo").replace("{STATE}", "state");
log.info("---oauth_api===="+oauth_api); log.info("---oauth_api===="+oauth_api);
return oauth_api; return oauth_api;
} }
......
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