james 11 meses atrás
pai
commit
6bc20cdab6

+ 4 - 3
service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/web/WeChatController.java

@@ -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);