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"); }