|
@@ -26,7 +26,7 @@ public class WeChatMessage {
|
|
// @Value("${wx.templateId}")
|
|
// @Value("${wx.templateId}")
|
|
// private String templateId;
|
|
// private String templateId;
|
|
private static final String appId= "wx707fcfd7d09e02eb";
|
|
private static final String appId= "wx707fcfd7d09e02eb";
|
|
- private static final String secret= "w95K45G9-2xGocleqrtGoHwEGF6ocqSu8EbDBxCQSR0";
|
|
|
|
|
|
+ private static final String secret= "cf69d556bbc962fa60a59b0fece3fa95";
|
|
private static final String templateId= "f932c54f1cbd427b10218a0d1cfb88bf";
|
|
private static final String templateId= "f932c54f1cbd427b10218a0d1cfb88bf";
|
|
|
|
|
|
public void sendMsg(String deviceCode,String warningContent, Date uploadDate,String location,String openId){
|
|
public void sendMsg(String deviceCode,String warningContent, Date uploadDate,String location,String openId){
|
|
@@ -41,6 +41,7 @@ public class WeChatMessage {
|
|
String tokenUrl="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential";
|
|
String tokenUrl="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential";
|
|
tokenUrl = tokenUrl + "&appid=" + appId + "&secret=" + secret;
|
|
tokenUrl = tokenUrl + "&appid=" + appId + "&secret=" + secret;
|
|
String result = HttpUtil.get(tokenUrl);
|
|
String result = HttpUtil.get(tokenUrl);
|
|
|
|
+ System.out.println(result);
|
|
JSONObject jsonObject = JSONUtil.parseObj(result);
|
|
JSONObject jsonObject = JSONUtil.parseObj(result);
|
|
String token = jsonObject.get("access_token").toString();
|
|
String token = jsonObject.get("access_token").toString();
|
|
return token;
|
|
return token;
|
|
@@ -53,7 +54,7 @@ public class WeChatMessage {
|
|
HashMap<String, Object> paramMap = new HashMap<>();
|
|
HashMap<String, Object> paramMap = new HashMap<>();
|
|
paramMap.put("touser", openId); // 接收方
|
|
paramMap.put("touser", openId); // 接收方
|
|
paramMap.put("template_id", templateId); // 模板id
|
|
paramMap.put("template_id", templateId); // 模板id
|
|
- paramMap.put("page","pages/self/self"); // 消息中要跳转的页面
|
|
|
|
|
|
+ paramMap.put("page","pages/index/index"); // 消息中要跳转的页面
|
|
// 设置data 模板内容
|
|
// 设置data 模板内容
|
|
HashMap<String, Object> data = new HashMap<>();
|
|
HashMap<String, Object> data = new HashMap<>();
|
|
//报警设备
|
|
//报警设备
|