如果是 Bug:模板消息会收到两条重复的消息,而且剩下的两条仍然能收到
* Bug 表现是什么?预期表现是什么?
支付后发送3条模板消息,但是第一条有时会连发两条而且后面的两条仍然能正常的收到
* 如何复现?
* 提供一个最简复现 Demo
/**
* 订单下单推送
* @return
*/
public static JSONObject orderPush(Integer orderId,String prepay_id,String openId, String money,String orderNo,String shopName,String orderTime,RedisTemplate<String, String> redisTemplate1) {
String accessToken = AccessTokenUtils.getMiniAccessToken(redisTemplate1);
String url = pushurl + accessToken;
Map<String, TemplateData> m = new HashMap<String, TemplateData>();
TemplateData reminder = new TemplateData();
reminder.setColor("#000000");
reminder.setValue(“您已成功支付订单,祝您用餐愉快!”);
m.put(“keyword1”, reminder);
TemplateData orderNot = new TemplateData();
orderNot.setColor("#000000");
orderNot.setValue(orderNo);
m.put(“keyword2”, orderNot);
TemplateData moneyt = new TemplateData();
moneyt.setColor("#000000");
moneyt.setValue(money);
m.put(“keyword3”, moneyt);
TemplateData shopNamet = new TemplateData();
shopNamet.setColor("#000000");
shopNamet.setValue(shopName);
m.put(“keyword4”, shopNamet);
TemplateData orderTimet= new TemplateData();
orderTimet.setColor("#000000");
orderTimet.setValue(orderTime);
m.put(“keyword5”, orderTimet);
//构造模板参数
WxTemplate temp = new WxTemplate();
// temp.setUrl(“http://ad.kulizhi.com”);
temp.setTouser(openId);
temp.setTemplate_id(TemplateConstant.order); // 推送订单模版
temp.setForm_id(prepay_id);
// temp.setTopcolor("#000000");
temp.setData(m);
temp.setPage(“pages/orderparticulars/orderparticulars?id=”+orderId);
String jsonString = JSONObject.toJSONString(temp);
JSONObject jsonObject = WeixinUtil.httpRequest(url, “POST”, jsonString);
System.out.println(jsonObject);
return jsonObject;
}