修改微信授权登录参数
This commit is contained in:
		| @@ -28,8 +28,8 @@ public class WechatUtil { | ||||
|     /** | ||||
|      * 生成signature | ||||
|      **/ | ||||
|     private static String appid = "wx7cab1155e849fe18"; | ||||
|     private static String secret = "0263f34d422d24588d6c2df8f09500ab"; | ||||
|     private static String appid = "wx9d1cbc11c8c40ba7"; | ||||
|     private static String secret = "38e87cf6251945446e8ac091a0ba9ab2"; | ||||
|     public AppWechatEntity sign(String url) { | ||||
|         Map<String, String> ret = new HashMap(); | ||||
|         String nonceStr = create_nonce_str(); | ||||
| @@ -172,6 +172,7 @@ public class WechatUtil { | ||||
|     private String getAccessTokenData(String url) { | ||||
|         String str = ""; | ||||
|         String result = HttpUtil.get(url, CharsetUtil.CHARSET_UTF_8); | ||||
|         System.out.println("result=============="+result); | ||||
|         if (StringUtils.isEmpty(result)) | ||||
|             return str; | ||||
|         str = parseData("access_token", "expires_in", result); | ||||
| @@ -217,12 +218,10 @@ public class WechatUtil { | ||||
|     /** | ||||
|      * 通过code获取微信用户的openid和session_key | ||||
|      * | ||||
|      * @param appid     小程序appid | ||||
|      * @param secret 小程序secret | ||||
|      * @param code      登录凭证code | ||||
|      * @return 包含openid、session_key、unionid的JSON对象 | ||||
|      */ | ||||
|     public JSONObject code2Session(String appid, String secret, String code) { | ||||
|     public JSONObject code2Session(String code) { | ||||
|         try { | ||||
|             String response = getAccessTokenData("https://api.weixin.qq.com/sns/jscode2session?appid="+appid+"&secret="+secret+"&js_code="+code+"&grant_type=authorization_code"); | ||||
|             JSONObject result = JSONObject.parseObject(response); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user