From fd83395529437e0c02b8d69b039fe52d40a4ec62 Mon Sep 17 00:00:00 2001 From: 44323 <443237572@qq.com> Date: 星期一, 04 十二月 2023 12:07:36 +0800 Subject: [PATCH] 小程序接口 --- guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/weChat/WeChatUtil.java | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/weChat/WeChatUtil.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/weChat/WeChatUtil.java index b6f5cc9..7b08e00 100644 --- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/weChat/WeChatUtil.java +++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/weChat/WeChatUtil.java @@ -95,6 +95,8 @@ * @return */ public Map<String, Object> code2Session(String jscode) throws Exception{ + System.err.println("看看调用奥"); + System.err.println("jsCode"+"========="+jscode); String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + wxAppletsAppid + "&secret=" + wxAppletsAppSecret + "&js_code=" + jscode + "&grant_type=authorization_code"; HttpResult httpResult = httpClientUtil.pushHttpRequset("GET", url, null, null, "form"); @@ -102,9 +104,11 @@ return null; } JSONObject jsonObject = JSON.parseObject(httpResult.getData()); + System.err.println("返回json串"+jsonObject); int errcode = jsonObject.getIntValue("errcode"); Map<String, Object> map = new HashMap<>(); map.put("errcode", errcode); + System.err.println("返回code"+errcode); if(errcode == 0){//成功 map.put("openid", jsonObject.getString("openid")); map.put("sessionKey", jsonObject.getString("session_key")); -- Gitblit v1.7.1