This commit is contained in:
wangw 2025-10-20 18:16:10 +08:00
parent e491d77e65
commit 370555aa66
1 changed files with 11 additions and 10 deletions

View File

@ -55,16 +55,17 @@ public class AcAccountUtil {
log.error("获取 access_token 失败"); log.error("获取 access_token 失败");
return ""; return "";
} }
JSONObject bodyJson = new JSONObject(); String bodyJson = "{\"action_info\":{\"scene\":{\"scene_str\":\"10839\"}},\"action_name\":\"QR_STR_SCENE\",\"expire_seconds\":\"2592000\"}";
//二维码有效时间最大2592000仅临时二维码需要 // JSONObject bodyJson = new JSONObject();
bodyJson.put("expire_seconds", "2592000"); // //二维码有效时间最大2592000仅临时二维码需要
//二维码类型QR_SCENE(临时整型)/QR_STR_SCENE(临时字符串)/QR_LIMIT_SCENE(永久整型)/QR_LIMIT_STR_SCENE(永久字符串) // bodyJson.put("expire_seconds", "2592000");
bodyJson.put("action_name", "QR_STR_SCENE"); // //二维码类型QR_SCENE(临时整型)/QR_STR_SCENE(临时字符串)/QR_LIMIT_SCENE(永久整型)/QR_LIMIT_STR_SCENE(永久字符串)
JSONObject actionInfo = new JSONObject(); // bodyJson.put("action_name", "QR_STR_SCENE");
JSONObject scene = new JSONObject(); // JSONObject actionInfo = new JSONObject();
scene.put("scene_str", userId.toString()); // JSONObject scene = new JSONObject();
actionInfo.put("scene", scene); // scene.put("scene_str", userId.toString());
bodyJson.put("action_info", actionInfo); // actionInfo.put("scene", scene);
// bodyJson.put("action_info", actionInfo);
String url = StrUtil.format("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token={}", accessToken); String url = StrUtil.format("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token={}", accessToken);
String resp = HttpUtil.post(url, bodyJson); String resp = HttpUtil.post(url, bodyJson);
/** /**