Explorar el Código

Merge branch 'usky-zyj' of uskycloud/usky-modules into server-165

James hace 1 año
padre
commit
e3fb1a4d45

+ 2 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/constant/constant.java

@@ -11,6 +11,8 @@ public class constant {
     public static final String WE_CHAT_CODE_URL = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s&response_type=code&scope=%s&state=STATE#wechat_redirect";
     // 回调地址,获取open_id
     public static final String WE_CHAT_CALL_BACK_DOMAIN_URL = "http://localhost:9887/weChat/getWeChatOpenId";
+    // 回调域名
+    public static final String call_back_domain = "aiot.usky.cn";
     // 微信公众号的token获取地址
     public static final String WE_CHAT_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s";
     // 微信公众号消息推送地址

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

@@ -59,7 +59,7 @@ public class WeChatController {
         if(userAgent.contains("MicroMessenger")){ //wx
             request.getSession().setAttribute("type","wx");
             if(StringUtils.isBlank(code)){
-                String url = URLDecoder.decode(http+request.getServerName()+request.getRequestURI());
+                String url = URLDecoder.decode(http+constant.call_back_domain+request.getRequestURI());
                 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);
@@ -138,7 +138,7 @@ public class WeChatController {
             }else{
                 if((null == request.getSession().getAttribute("openid")) && (StringUtils.isBlank(request.getSession().getAttribute("openid").toString()))){
                     if(StringUtils.isBlank(code)){
-                        String url = URLDecoder.decode(http+request.getServerName()+request.getRequestURI());
+                        String url = URLDecoder.decode(http+constant.call_back_domain+request.getRequestURI());
                         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);