From 46ad424ee71fb9107d5d4c61282a0797e7461969 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Mon, 13 Mar 2023 10:43:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AF=9D=E8=B4=B9=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E4=BB=BB=E5=8A=A1=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/hai/config/WeChatQrcodeUtils.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hai-service/src/main/java/com/hai/config/WeChatQrcodeUtils.java b/hai-service/src/main/java/com/hai/config/WeChatQrcodeUtils.java index b3da3b39..a70567c3 100644 --- a/hai-service/src/main/java/com/hai/config/WeChatQrcodeUtils.java +++ b/hai-service/src/main/java/com/hai/config/WeChatQrcodeUtils.java @@ -11,6 +11,7 @@ import com.google.zxing.qrcode.QRCodeReader; import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.RedisUtil; import com.hai.common.utils.ResponseMsgUtil; +import com.hai.enum_type.ActionNameEnum; import com.hai.model.TextMessage; import lombok.extern.slf4j.Slf4j; import me.chanjar.weixin.common.error.WxErrorException; @@ -104,13 +105,13 @@ public class WeChatQrcodeUtils { } // 创建微信二维码 - public JSONObject createWxQrCode(String sceneStr) { + public JSONObject createWxQrCode(String sceneStr , String actionName) { JSONObject object = new JSONObject(); JSONObject objectScene = new JSONObject(); JSONObject objectActionInfo = new JSONObject(); objectScene.put("scene_str" , sceneStr); objectActionInfo.put("scene" , objectScene); - object.put("action_name" , "QR_STR_SCENE"); + object.put("action_name" , actionName); object.put("expire_seconds" , 2592000); object.put("action_info" , objectActionInfo); return HttpsUtils.doPost("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + getWxToken(), object); @@ -343,7 +344,7 @@ public class WeChatQrcodeUtils { String sceneId = "type=" + type + "&code=" + code + "&encryptType=" + encryptType; // 获取二维码参数 - JSONObject wxQr = createWxQrCode(sceneId); + JSONObject wxQr = createWxQrCode(sceneId , ActionNameEnum.actionName1.getName()); return wxQr.getString("url"); } @@ -354,7 +355,7 @@ public class WeChatQrcodeUtils { String sceneId = "type=" + type + "&code=" + code; // 获取二维码参数 - JSONObject wxQr = createWxQrCode(sceneId); + JSONObject wxQr = createWxQrCode(sceneId , ActionNameEnum.actionName1.getName()); return wxQr.getString("url"); }