验证消息
This commit is contained in:
@@ -75,7 +75,7 @@ public class AcAccountUtil {
|
||||
*/
|
||||
JSONObject respInfo = JSONObject.parseObject(resp);
|
||||
if (respInfo.get("url") == null) {
|
||||
log.error("创建临时二维码失败, 响应内容: {}", resp);
|
||||
log.error("创建临时二维码失败,发送参数: {}, 响应内容: {}", bodyJson, resp);
|
||||
return "";
|
||||
}
|
||||
return respInfo.get("url").toString();
|
||||
@@ -102,14 +102,7 @@ public class AcAccountUtil {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String resp = HttpUtil.get(StrUtil.format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={}&secret={}",
|
||||
"wx1fb600d0f5ea6279", "b4c0534c9b5e6c84a7fe5c2078dff876"));
|
||||
JSONObject respInfo = JSONObject.parseObject(resp);
|
||||
if (!respInfo.containsKey("access_token")) {
|
||||
log.warn("公众号获取token失败, 响应内容: {}", resp);
|
||||
throw new RuntimeException(resp);
|
||||
}
|
||||
String accessToken = respInfo.getString("access_token");
|
||||
String accessToken = "97_Kgg5H4EvOGc67n2GoR7Kqp-NuREOMuzesG0CpbNrx1JhvM6axp9Ub6OoZzBeANuQI3vExR9onbEeBhLdgiMjLjxpiwgDmXOgvZS_rEL5S766QVJQ7p2eggksyuQFPRdAEALVX";
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
//二维码有效时间(秒),最大2592000,仅临时二维码需要
|
||||
bodyJson.put("expire_seconds", "2592000");
|
||||
|
||||
Reference in New Issue
Block a user