|
@@ -37,6 +37,7 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
import java.io.IOException;
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.text.ParseException;
|
|
@@ -67,7 +68,7 @@ public class WeChatController {
|
|
|
* 调用的第一个接口,获取微信公众号CODE,获取openid
|
|
|
*/
|
|
|
@GetMapping("/getFirst1")
|
|
|
- public void getFirst1(){
|
|
|
+ public void getFirst1() throws UnsupportedEncodingException {
|
|
|
String http = "https://";
|
|
|
String code = request.getParameter("code");
|
|
|
String userAgent = request.getHeader("User-Agent");
|
|
@@ -75,8 +76,8 @@ public class WeChatController {
|
|
|
if(userAgent.contains("MicroMessenger")){ //wx
|
|
|
request.getSession().setAttribute("type","wx");
|
|
|
if(StringUtils.isBlank(code)){
|
|
|
- //String url = URLDecoder.decode(http+constant.call_back_domain+request.getRequestURI());
|
|
|
- String url = URLDecoder.decode("https://manager.usky.cn/mobile/pages/login");
|
|
|
+ String temp = http+constant.call_back_domain+request.getRequestURI();
|
|
|
+ String url = URLDecoder.decode(temp, "UTF-8");
|
|
|
String sendUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+constant.WE_CHAT_APP_ID+"&redirect_uri="+url+"&response_type=code&scope=snsapi_base&state=abc123#wechat_redirect";
|
|
|
try{
|
|
|
System.out.println("sendUrl: "+sendUrl);
|