| | |
| | | orderStateMsgVo.setTouser(info.getOpenId());//用户的openId |
| | | orderStateMsgVo.setTemplate_id(info.getTemplateId());//订阅消息模板id |
| | | orderStateMsgVo.setPage(info.getPage()); |
| | | Map<String, WxTemplateData> m = new HashMap<>(4); |
| | | m.put("character_string2", new WxTemplateData(info.getOrderNo())); |
| | | m.put("thing11", new WxTemplateData(info.getGoodsName())); |
| | | m.put("amount1", new WxTemplateData(info.getAmount())); |
| | | m.put("character_string9", new WxTemplateData(info.getTakeCode())); |
| | | Map<String, WxTemplateData> m = new HashMap<>(5); |
| | | m.put("thing4.DATA", new WxTemplateData(info.getAddressArea())); |
| | | m.put("phone_number14.DATA", new WxTemplateData(info.getLeaderPhone())); |
| | | m.put("thing3.DATA", new WxTemplateData(info.getGoodsName())); |
| | | m.put("thing5.DATA", new WxTemplateData(info.getDetailAddress())); |
| | | m.put("thing15.DATA", new WxTemplateData(info.getRemark())); |
| | | orderStateMsgVo.setData(m); |
| | | String s = JSONUtil.toJsonStr(orderStateMsgVo); |
| | | log.info(s); |
| | |
| | | @Override |
| | | public List<String> getTemplateId() { |
| | | List<String> wxTemplates = new ArrayList<>(); |
| | | List<DataDictionaryCustom> wxTemplateList = dataDictionaryCustomMapper.selectDicByType(DataDictionaryEnum.WX_TEMPLATE_ID_ONE.getType()); |
| | | List<DataDictionaryCustom> wxTemplateList = dataDictionaryCustomMapper.selectDicByType(DataDictionaryEnum.WX_TEMPLATE_ID_THREE.getType()); |
| | | if(CollUtil.isNotEmpty(wxTemplateList)){ |
| | | for(DataDictionaryCustom dic : wxTemplateList){ |
| | | wxTemplates.add(dic.getValue()); |
| | |
| | | |
| | | String randomNum = MallUtils.getRandomNum(5); |
| | | String imgName="/user_" + randomNum + "_acode_1.jpg"; |
| | | String codeImgPath = generateAcode(wxGenerateQrCodeDto.getScene(), wxGenerateQrCodeDto.getPage(), imgName, "800px", null); |
| | | String codeImgPath = generateAcode(wxGenerateQrCodeDto.getScene(), wxGenerateQrCodeDto.getPage(), imgName, "400px", null); |
| | | if(1 == type){ |
| | | long goodsId = StrUtil.isBlank(wxGenerateQrCodeDto.getTypeParam()) ? 0L : Long.parseLong(wxGenerateQrCodeDto.getTypeParam()); |
| | | MallGoods mallGoods = mallGoodsMapper.selectById(goodsId); |
| | |
| | | if (type == null) { |
| | | // 该接口无数量限制,但是 scene 传参最大字符长度为32个字符 |
| | | url = StrFormatter.format("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={}",redisUtils.get(WechatConfigure.WX_ACCESS_TOKEN_REDIS_KEY).toString()); |
| | | obj.put("scene", scene); |
| | | obj.put("path", path); |
| | | obj.set("scene", scene); |
| | | obj.set("page", path); |
| | | } else { |
| | | // 该接口存在数量限制, 总共可生成10w个, 但参数是接在path后面 |
| | | url = StrFormatter.format("https://api.weixin.qq.com/wxa/getwxacode?access_token={}", redisUtils.get(WechatConfigure.WX_ACCESS_TOKEN_REDIS_KEY).toString()); |
| | | obj.put("path", path + "?" + scene ); |
| | | obj.set("page", path + "?" + scene ); |
| | | } |
| | | |
| | | //最小 280px,最大 1280px |
| | | obj.put("width", width); |
| | | obj.put("auto_color", false); |
| | | obj.set("width", width); |
| | | obj.set("auto_color", false); |
| | | cn.hutool.json.JSONObject obj2 = JSONUtil.createObj(); |
| | | obj2.put("r", 0); |
| | | obj2.put("g", 0); |
| | | obj2.put("b", 0); |
| | | obj.put("line_color", obj2); |
| | | obj2.set("r", 0); |
| | | obj2.set("g", 0); |
| | | obj2.set("b", 0); |
| | | obj.set("line_color", obj2); |
| | | //是否需要透明底色,为 true 时,生成透明底色的小程序码 |
| | | obj.put("is_hyaline", false); |
| | | obj.set("is_hyaline", false); |
| | | try { |
| | | HttpResponse execute = HttpRequest.post(url).body(obj.toString(), "application/json").execute(); |
| | | InputStream inputStream = execute.bodyStream(); |