he2802 4 лет назад
Родитель
Сommit
0e65becafd

+ 5 - 4
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/WxLoginService.java

@@ -108,12 +108,13 @@ public class WxLoginService
         String param = String.format(wxAuthParam, appid, appsrcret, loginBody.getCode());
         String resultString  = HttpUtils.sendGet(wxAuthUrl,param);
         //解析json
-        JSONObject jsonObject1 = (JSONObject) JSONObject.parse(resultString);
-        String session_key = jsonObject1.get("session_key")+"";
-        String openid = jsonObject1.get("openid")+"";
+        JSONObject jsonObject = (JSONObject) JSONObject.parse(resultString);
+        String session_key = String.valueOf(jsonObject.get("session_key"));
+        String openId = String.valueOf(jsonObject.get("openid"));
+        String unionId = String.valueOf(jsonObject.get("unionid"));
     //    WxLoginResultBo wxLoginResult = restTemplate.getForObject(url, WxLoginResultBo.class);
         String wxResult = obtainWxPhone(loginBody.getIv(),loginBody.getEncryptedData(),session_key);
-        return resultString;
+        return wxResult;
     }
 
     public String obtainWxPhone(String iv, String encryptedData,String session_key){