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 失败");
return "";
}
JSONObject bodyJson = new JSONObject();
//二维码有效时间最大2592000仅临时二维码需要
bodyJson.put("expire_seconds", "2592000");
//二维码类型QR_SCENE(临时整型)/QR_STR_SCENE(临时字符串)/QR_LIMIT_SCENE(永久整型)/QR_LIMIT_STR_SCENE(永久字符串)
bodyJson.put("action_name", "QR_STR_SCENE");
JSONObject actionInfo = new JSONObject();
JSONObject scene = new JSONObject();
scene.put("scene_str", userId.toString());
actionInfo.put("scene", scene);
bodyJson.put("action_info", actionInfo);
String bodyJson = "{\"action_info\":{\"scene\":{\"scene_str\":\"10839\"}},\"action_name\":\"QR_STR_SCENE\",\"expire_seconds\":\"2592000\"}";
// JSONObject bodyJson = new JSONObject();
// //二维码有效时间最大2592000仅临时二维码需要
// bodyJson.put("expire_seconds", "2592000");
// //二维码类型QR_SCENE(临时整型)/QR_STR_SCENE(临时字符串)/QR_LIMIT_SCENE(永久整型)/QR_LIMIT_STR_SCENE(永久字符串)
// bodyJson.put("action_name", "QR_STR_SCENE");
// JSONObject actionInfo = new JSONObject();
// JSONObject scene = new JSONObject();
// scene.put("scene_str", userId.toString());
// 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 resp = HttpUtil.post(url, bodyJson);
/**