From 2e3c12ca3a7241f498c32121cb1572502c998d0d Mon Sep 17 00:00:00 2001
From: 935090232@qq.com <ak473600000>
Date: Sat, 09 Jan 2021 00:42:00 +0800
Subject: [PATCH] 公众号模板消息demo
---
zq-erp/src/main/resources/config/system.properties | 4 ++--
zq-erp/src/main/resources/config/test/system.properties | 2 ++
zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/MsgDemo2.java | 4 +++-
zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/GzhTemplateMessagePojo.java | 11 ++++++++---
4 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/GzhTemplateMessagePojo.java b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/GzhTemplateMessagePojo.java
index 8a81464..d6c6517 100644
--- a/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/GzhTemplateMessagePojo.java
+++ b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/GzhTemplateMessagePojo.java
@@ -11,6 +11,7 @@
*/
public class GzhTemplateMessagePojo {
+ private String appid;
private String touser;
private String template_id;
private String url;
@@ -68,11 +69,15 @@
}
+ public String getAppid() {
+ return appid;
+ }
+ public void setAppid(String appid) {
+ this.appid = appid;
+ }
-
-
- public void setMiniprogram(String appid,String url){
+ public void setMiniprogram(String appid, String url){
this.setMiniprogram(new Miniprogram(appid,url));
}
public void setFirst(String value, String color){
diff --git a/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/MsgDemo2.java b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/MsgDemo2.java
index 0c6f7f9..b50626a 100644
--- a/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/MsgDemo2.java
+++ b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/MsgDemo2.java
@@ -26,10 +26,11 @@
public AjaxResult template() {
UniformMsgPojo uniformMsgPojo=new UniformMsgPojo();
GzhTemplateMessagePojo messagePojo=new GzhTemplateMessagePojo();
- uniformMsgPojo.setTouser("o8EB656NQYwhUuKPMhVVwP_wtLJI");
+ uniformMsgPojo.setTouser("oJkRK4yelehsY4S7I6Ee1ydWtQMI");
messagePojo.setTemplate_id("Mqu9xPYj_JFhXNj7nLJS7LESQUy6Z7FoCOmVO66Oxe8");
//messagePojo.setUrl("www.baidu.com");
// messagePojo.setMiniprogram(gzhAppId,"/123/234123412");
+ messagePojo.setAppid("wx57e6335559bdbda6");
messagePojo.setFirst("尊敬的谭娅:","#453454");
messagePojo.setKeyWord("活细胞肩部护理","#453454");
messagePojo.setKeyWord("2014年7月21日 18:36","#453454");
@@ -39,6 +40,7 @@
String url="https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=ACCESS_TOKEN".replaceAll("ACCESS_TOKEN",ACCESS_TOKEN);
uniformMsgPojo.setMp_template_msg(messagePojo);
+
System.out.println(JSONObject.toJSON(uniformMsgPojo).toString());
JSONObject result= HttpClientUtil.sendPostWithJson(url,JSONObject.toJSON(uniformMsgPojo).toString());
System.out.println(result.toString());
diff --git a/zq-erp/src/main/resources/config/system.properties b/zq-erp/src/main/resources/config/system.properties
index c095872..8a17d20 100644
--- a/zq-erp/src/main/resources/config/system.properties
+++ b/zq-erp/src/main/resources/config/system.properties
@@ -48,8 +48,8 @@
wechar_login_url =https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code
-xcx_appid =wx3836ab3c1490ff29
-xcx_secret =39a3687ec5b2666ed68e7c8b83b26b47
+xcx_appid =wx5cc58f796224af61
+xcx_secret =facea088aae414e5c2ee86b459887721
#公众号
gzh_appid=wx57e6335559bdbda6
diff --git a/zq-erp/src/main/resources/config/test/system.properties b/zq-erp/src/main/resources/config/test/system.properties
index 9f3fda6..a6ae4c0 100644
--- a/zq-erp/src/main/resources/config/test/system.properties
+++ b/zq-erp/src/main/resources/config/test/system.properties
@@ -48,6 +48,8 @@
wechar_login_url =https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code
xcx_appid =wx5cc58f796224af61
xcx_secret =facea088aae414e5c2ee86b459887721
+gzh_appid=wx57e6335559bdbda6
+gzh_secret=ecb408af170e3890e6544290cad33760
#微信支付调试开关
wx_pay_debug_onoff = false
--
Gitblit v1.9.1