第一步:https://mp.weixin.qq.com/debug/cgi-bin/sandboxinfo?action=showinfo&t=sandbox/index 进入测试账号, 如下图:
第二步:创建推送模板,如下图:
第三步:添加微信包
<!-- 微信公众号消息推送-->
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-mp</artifactId>
<version>3.6.0</version>
</dependency>
第四步:创建 WxTemplate 类
public class WxTemplate {
//进行推送所需参数
private String touser;//用户openid(接收人)
private String template_id;//消息模版id
private String url = "https://baidu.com";//跳转到某链接或某页面
private Map<String, WxTemplateData> data;//要推送的模板内容
public String getTouser() {
return touser;
}
public void setTouser(String touser) {
this.touser = touser;
}
public String getTemplate_id() {
return template_id;
}
pu