1、小程序按钮表单,提交formid和openid
注:https://blog.csdn.net/qq_38191191/article/details/80982732
2、发送网络请求(小程序点击按钮时)
注:https://www.kancloud.cn/zhipeng/miniapp/314485
3、服务端接收网络请求
注:http://www.jfinal.com/feedback/2846 (小程序本身相当于客户端项目)
另:公众平台配置服务器域名及添加模板消息
4、服务端接收formid和openid后发送模板消息
String openid = getPara("openid");
String formid = getPara("form_id");
String access_token=WxaAccessTokenApi.getAccessToken().getAccessToken();
System.out.println("access_token:"+access_token);
WxaTemplate template=new WxaTemplate();
String touser=openid;
String template_id="7UIsQraD4ZSh_0JyUgIM-_ilUw49Lspdgi0LRSZd2cI";
template.setTouser(touser);
template.setTemplate_id(template_id);
template.setPage("index");
template.setForm_id(formid);
template.add("keyword1", "11222333").add("keyword2", "2015333年01月05日 12:30")
.add("keyword3", "腾讯微信总2部").add("keyword4", "广州市海2珠区新港中路397 号").setEmphasis_keyword("keyword1.DATA");
WxaTemplateApi t = new WxaTemplateApi();
renderJson(t.send(template));