String accessToken = getAccessToken(requestDTO.getAppId(), requestDTO.getSecret());String url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=" + accessToken;Map
param = new HashMap();param.put("touser", requestDTO.getOpenId());param.put("template_id", requestDTO.getTemplateId());param.put("page", "pages/ddctime/ddctime");param.put("form_id", requestDTO.getFormId());//TODOlogger.info("weixin push request fomrnId is {}", requestDTO.getFormId());Map data = new HashMap();Map keyword1 = new HashMap();keyword1.put("value", requestDTO.getKeyword1());data.put("keyword1", keyword1);Map keyword2 = new HashMap();keyword2.put("value", requestDTO.getKeyword2());data.put("keyword2", keyword2);Map keyword3 = new HashMap();keyword3.put("value", requestDTO.getKeyword3());data.put("keyword3", keyword3);Map keyword4 = new HashMap();keyword4.put("value", requestDTO.getKeyword4());data.put("keyword4", keyword4);param.put("data", data);logger.info(JsonUtil.objectToJSON(param));//param.put("mp_template_msg", value);HttpHeaders headers = new HttpHeaders();MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");headers.setContentType(type);headers.add("Accept", MediaType.APPLICATION_JSON.toString());String params = JsonUtil.objectToJSON(param);logger.info("weixin push param is {}", params);HttpEntity formEntity = new HttpEntity(params, headers);Map resultMap = restTemplate.postForObject(url, formEntity, Map.class);logger.info(JsonUtil.objectToJSON(resultMap));logger.info("weixin push result is {}", JsonUtil.objectToJSON(resultMap));return JsonUtil.objectToJSON(resultMap);
每次都是报41028 form_id不正确,求救
微信小程序开发问题解答
微信小程序开发者回答:
检查你的formid,具体是怎么获取的,格式是什么样的,日志记录输出的是什么?
本文网址:http://www.91bianli.com/weixinxiaochengxu/24179.html