From f4cf892b9282a554dcec4312081b6ea795c7b477 Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Thu, 4 Apr 2019 14:50:07 +0800 Subject: [PATCH 1/6] =?UTF-8?q?[=E6=94=AF=E6=8C=81test=E7=8E=AF=E5=A2=83][?= =?UTF-8?q?=E6=96=B0=E5=A2=9E]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-test.yml | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 mlWechatOpen/src/main/resources/application-test.yml diff --git a/mlWechatOpen/src/main/resources/application-test.yml b/mlWechatOpen/src/main/resources/application-test.yml new file mode 100644 index 0000000..77c7bb6 --- /dev/null +++ b/mlWechatOpen/src/main/resources/application-test.yml @@ -0,0 +1,105 @@ +spring: + profiles: + include: rabbitMQ + # JDBC + datasource: + url: jdbc:mysql://formalldb.cfqyqflkdlit.rds.cn-northwest-1.amazonaws.com.cn:3306/mallinkTest?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&useSSL=false&useAffectedRows=true + username: ENC(Uc0AjgkytxHHCwZrmDASWg==) + password: ENC(nV4Mi3bEbBx0Fj7uUyYH55eTaqsFMjKvmNzagicH4pc=) + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + filters: stat + maxActive: 20 + initialSize: 1 + maxWait: 60000 + minIdle: 1 + timeBetweenEvictionRunsMillis: 28000 + minEvictableIdleTimeMillis: 28000 + validationQuery: select 'x' + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + poolPreparedStatements: true + maxOpenPreparedStatements: 20 + connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=6000" + # REDIS + redis: + host: 127.0.0.1 + port: 6379 + password: ENC(QFwqv3NshvvGhFPiP8rwhvbnxk+rFSqhJi8Pw6TogSg=) + timeout: 3600 + expire: 1800 #30分钟 + database: 1 + defaultExpiration: 2592000 # 默认生命周期30天 + jedis: + pool: + max-active: 100 + max-idle: 20 + max-wait: -1 + min-idle: 0 + # EMAIL + mail: + host: smtp.exmail.qq.com + username: ENC(HFbRXtAFVxU36Hk0yT3reyvRuLrw3RhMlbxFj9Ev/VY=) + password: ENC(pk4+/3C5n2hMYmgi+VTqI4P1m77DllW8y4KElMXXmIo=) # 授权密码 + properties: + mail: + smtp: + auth: true + starttls: + enable: true + socketFactory: + port: 465 + class: javax.net.ssl.SSLSocketFactory + # RABBITMQ + rabbitmq: + host: 127.0.0.1 + port: 5672 + username: ENC(aSRr6mnSryEqzHHz1hJf1g==) + password: ENC(GnjF/mdqKdvmDYC0tIIso7+20/jBALPw39tiWCYJ4iw=) + publisher-confirms: true + virtual-host: / + flyway: + enabled: true + +aws: + clientRegion: cn-northwest-1 + bucketName: iformall-net + access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=) + secret: ENC(TRcZqql0Rq5PExlMeH/4WiZ/i02b8FXKmLTBChJmbluTa1uoLS9LrHyNEMrqe1DK+QgOAdvqGBo=) + +wechat: + open: + componentAppId: ENC(hnH31XdNzArfMfikKgBFpqQuJUl6rVOPFFcAVyb595o) + componentSecret: ENC(t/GUVX5L+U7LCwSvZ5WmxAnmTMrc/Uy1nljsrokuzzsBL2j6BEVnrS/n7DCdGc/G) + componentToken: ENC(gUF1m0YgCCI2IY54fX6sGLZVlCswA8tG) + componentAesKey: ENC(TYHcrIkICtfrCfGq4HW6s1b/pHf7OD2uyPN11SzJNB0acqJ/4JVX1nuljo/cAtgMG4O05TImLQc=) + redis: + host: 127.0.0.1 + port: 6379 + password: ENC(QFwqv3NshvvGhFPiP8rwhvbnxk+rFSqhJi8Pw6TogSg=) + timeout: 3600 + expire: 1800 #30分钟 + database: 2 + defaultExpiration: 2592000 # 默认生命周期30天 + jedis: + pool: + max-active: 100 + max-idle: 100 + max-wait: -1 + min-idle: 10 + +fm: + exception: true + +ueditor: + config: config.json + unified: true + upload-path: ./upload/ + url-prefix: "" + +logging: + level: + tk.mybatis: debug + com.iformall: debug + path: ./logs/admin \ No newline at end of file From 20cdf7dfcab08551585ed7f06215c556fc56d52d Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Thu, 4 Apr 2019 15:26:17 +0800 Subject: [PATCH 2/6] =?UTF-8?q?[=E6=94=AF=E6=8C=81test=E7=8E=AF=E5=A2=83][?= =?UTF-8?q?=E6=96=B0=E5=A2=9E]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mlWechatOpen/src/main/resources/application-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/mlWechatOpen/src/main/resources/application-test.yml b/mlWechatOpen/src/main/resources/application-test.yml index 77c7bb6..359b65b 100644 --- a/mlWechatOpen/src/main/resources/application-test.yml +++ b/mlWechatOpen/src/main/resources/application-test.yml @@ -91,6 +91,7 @@ wechat: fm: exception: true + delay: 2 ueditor: config: config.json From 09eb25f62f90a6072b0b4d6c2f2118e628bbdfe7 Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Thu, 4 Apr 2019 15:31:47 +0800 Subject: [PATCH 3/6] =?UTF-8?q?[=E6=94=AF=E6=8C=81test=E7=8E=AF=E5=A2=83][?= =?UTF-8?q?=E6=96=B0=E5=A2=9E]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/iformall/WechatOpenApplication.java | 6 +++--- .../com/iformall/controller/WxWeappBasicSetController.java | 4 ++-- .../java/com/iformall/controller/WxWeappInfoController.java | 4 ++-- mlWechatOpen/src/main/resources/application-dev.yml | 2 +- mlWechatOpen/src/main/resources/application-prod.yml | 2 +- mlWechatOpen/src/main/resources/application-test.yml | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mlWechatOpen/src/main/java/com/iformall/WechatOpenApplication.java b/mlWechatOpen/src/main/java/com/iformall/WechatOpenApplication.java index 18a87a7..0c2ecab 100644 --- a/mlWechatOpen/src/main/java/com/iformall/WechatOpenApplication.java +++ b/mlWechatOpen/src/main/java/com/iformall/WechatOpenApplication.java @@ -27,11 +27,11 @@ public class WechatOpenApplication { return fmException; } - @Value("${fm.delay}") - private Integer fmDelay; + @Value("${fm.deploy}") + private Integer fmDeploy; @Bean - public Integer getFmDelay() { return fmDelay; } + public Integer getFmDeploy() { return fmDeploy; } diff --git a/mlWechatOpen/src/main/java/com/iformall/controller/WxWeappBasicSetController.java b/mlWechatOpen/src/main/java/com/iformall/controller/WxWeappBasicSetController.java index c124e11..c32f35d 100644 --- a/mlWechatOpen/src/main/java/com/iformall/controller/WxWeappBasicSetController.java +++ b/mlWechatOpen/src/main/java/com/iformall/controller/WxWeappBasicSetController.java @@ -25,7 +25,7 @@ public class WxWeappBasicSetController extends BaseController { private final Logger logger = LoggerFactory.getLogger(getClass()); @Autowired - private Integer getFmDelay; + private Integer getFmDeploy; @Autowired private WxWeappBasicSetService weappBasicSetService; @@ -38,7 +38,7 @@ public class WxWeappBasicSetController extends BaseController { public ResultData list(@ModelAttribute WxWeappBasicSet weappBasicSet, Integer pageNum, Integer pageSize) { logger.debug("[" + getIpAddr() + "] WxWeappBasicSetController::list"); if (null == weappBasicSet) weappBasicSet = new WxWeappBasicSet(); - weappBasicSet.setDeploy(getFmDelay); + weappBasicSet.setDeploy(getFmDeploy); final PageInfo page = weappBasicSetService.listAsPage(weappBasicSet, pageNum, pageSize); return new ResultData(page); } diff --git a/mlWechatOpen/src/main/java/com/iformall/controller/WxWeappInfoController.java b/mlWechatOpen/src/main/java/com/iformall/controller/WxWeappInfoController.java index 6607e03..39d492d 100644 --- a/mlWechatOpen/src/main/java/com/iformall/controller/WxWeappInfoController.java +++ b/mlWechatOpen/src/main/java/com/iformall/controller/WxWeappInfoController.java @@ -52,7 +52,7 @@ public class WxWeappInfoController extends BaseController { private final Logger logger = LoggerFactory.getLogger(getClass()); @Autowired - private Integer getFmDelay; + private Integer getFmDeploy; @Autowired private WxAuthorizerInfoService authorizerInfoService; @@ -137,7 +137,7 @@ public class WxWeappInfoController extends BaseController { // 检查基础配置参数 WxWeappBasicSet weappBasicSetQ = new WxWeappBasicSet(); weappBasicSetQ.setType(type); - weappBasicSetQ.setDeploy(getFmDelay); + weappBasicSetQ.setDeploy(getFmDeploy); WxWeappBasicSet weappBasicSet = weappBasicSetService.getByTypeAndDeploy(weappBasicSetQ); if(weappBasicSet == null) { logger.error("未找到相关的基础设置参数"); diff --git a/mlWechatOpen/src/main/resources/application-dev.yml b/mlWechatOpen/src/main/resources/application-dev.yml index 10c1f16..24a353b 100644 --- a/mlWechatOpen/src/main/resources/application-dev.yml +++ b/mlWechatOpen/src/main/resources/application-dev.yml @@ -84,7 +84,7 @@ jasypt: fm: exception: false - delay: 1 + deploy: 1 logging: level: diff --git a/mlWechatOpen/src/main/resources/application-prod.yml b/mlWechatOpen/src/main/resources/application-prod.yml index fc9b970..c20c2d2 100644 --- a/mlWechatOpen/src/main/resources/application-prod.yml +++ b/mlWechatOpen/src/main/resources/application-prod.yml @@ -78,7 +78,7 @@ wechat: fm: exception: true - delay: 3 + deploy: 3 logging: level: diff --git a/mlWechatOpen/src/main/resources/application-test.yml b/mlWechatOpen/src/main/resources/application-test.yml index 359b65b..39c2819 100644 --- a/mlWechatOpen/src/main/resources/application-test.yml +++ b/mlWechatOpen/src/main/resources/application-test.yml @@ -91,7 +91,7 @@ wechat: fm: exception: true - delay: 2 + deploy: 2 ueditor: config: config.json From abc84cfb9b4808a78d6b602fb4f1bbd6b604411c Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Thu, 4 Apr 2019 16:45:00 +0800 Subject: [PATCH 4/6] =?UTF-8?q?[=E6=94=AF=E6=8C=81test=E7=8E=AF=E5=A2=83][?= =?UTF-8?q?=E6=96=B0=E5=A2=9E]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mlWechatOpen/src/main/resources/application-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlWechatOpen/src/main/resources/application-test.yml b/mlWechatOpen/src/main/resources/application-test.yml index 39c2819..b01f1b3 100644 --- a/mlWechatOpen/src/main/resources/application-test.yml +++ b/mlWechatOpen/src/main/resources/application-test.yml @@ -70,7 +70,7 @@ aws: wechat: open: - componentAppId: ENC(hnH31XdNzArfMfikKgBFpqQuJUl6rVOPFFcAVyb595o) + componentAppId: ENC(hnH31XdNzArfMfikKgBFpqQuJUl6rVOPFFcAVyb595o=) componentSecret: ENC(t/GUVX5L+U7LCwSvZ5WmxAnmTMrc/Uy1nljsrokuzzsBL2j6BEVnrS/n7DCdGc/G) componentToken: ENC(gUF1m0YgCCI2IY54fX6sGLZVlCswA8tG) componentAesKey: ENC(TYHcrIkICtfrCfGq4HW6s1b/pHf7OD2uyPN11SzJNB0acqJ/4JVX1nuljo/cAtgMG4O05TImLQc=) From d786cdbb69b6dc22886ae61c90a6f675d410644f Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Thu, 4 Apr 2019 17:04:23 +0800 Subject: [PATCH 5/6] =?UTF-8?q?[=E6=94=AF=E6=8C=81test=E7=8E=AF=E5=A2=83][?= =?UTF-8?q?=E6=96=B0=E5=A2=9E]=E6=B5=8B=E8=AF=95=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WechatCalllbackController.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/mlWechatOpen/src/main/java/com/iformall/controller/WechatCalllbackController.java b/mlWechatOpen/src/main/java/com/iformall/controller/WechatCalllbackController.java index 885ce61..e066686 100644 --- a/mlWechatOpen/src/main/java/com/iformall/controller/WechatCalllbackController.java +++ b/mlWechatOpen/src/main/java/com/iformall/controller/WechatCalllbackController.java @@ -13,6 +13,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage; import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; import me.chanjar.weixin.open.bean.message.WxOpenXmlMessage; @@ -203,6 +204,32 @@ public class WechatCalllbackController extends BaseController { openService.getWxOpenConfigStorage(), timestamp, nonce, msgSignature); logger.info("接收微信APP回调,消息解密后内容为:\n{}", inMessage.toString()); + // 全网发布测试用例 + if (StringUtils.equalsAnyIgnoreCase(appId, "wx570bc396a51b8ff8", "wxd101a85aa106f53e")) { + try { + if (StringUtils.equals(inMessage.getMsgType(), "text")) { + if (StringUtils.equals(inMessage.getContent(), "TESTCOMPONENT_MSG_TYPE_TEXT")) { + out = WxOpenXmlMessage.wxMpOutXmlMessageToEncryptedXml( + WxMpXmlOutMessage.TEXT().content("TESTCOMPONENT_MSG_TYPE_TEXT_callback") + .fromUser(inMessage.getToUser()) + .toUser(inMessage.getFromUser()) + .build(), + openService.getWxOpenConfigStorage() + ); + } else if (StringUtils.startsWith(inMessage.getContent(), "QUERY_AUTH_CODE:")) { + String msg = inMessage.getContent().replace("QUERY_AUTH_CODE:", "") + "_from_api"; + WxMpKefuMessage kefuMessage = WxMpKefuMessage.TEXT().content(msg).toUser(inMessage.getFromUser()).build(); + openService.getWxOpenComponentService().getWxMpServiceByAppid(appId).getKefuService().sendKefuMessage(kefuMessage); + } + } else if (StringUtils.equals(inMessage.getMsgType(), "event")) { + WxMpKefuMessage kefuMessage = WxMpKefuMessage.TEXT().content(inMessage.getEvent() + "from_callback").toUser(inMessage.getFromUser()).build(); + openService.getWxOpenComponentService().getWxMpServiceByAppid(appId).getKefuService().sendKefuMessage(kefuMessage); + } + } catch (WxErrorException e) { + logger.error("callback", e); + } + } + PrintWriter printWriter = response.getWriter(); if(appinfo.getType().equals(EnumAppType.B.getCode()) || From c03e442a09ca49a573d220cf328f9b9d39920820 Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Thu, 4 Apr 2019 20:21:19 +0800 Subject: [PATCH 6/6] =?UTF-8?q?[=E6=94=AF=E6=8C=81test=E7=8E=AF=E5=A2=83][?= =?UTF-8?q?=E6=96=B0=E5=A2=9E]=E6=B5=8B=E8=AF=95=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iformall/controller/WechatCalllbackController.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mlWechatOpen/src/main/java/com/iformall/controller/WechatCalllbackController.java b/mlWechatOpen/src/main/java/com/iformall/controller/WechatCalllbackController.java index e066686..4e175af 100644 --- a/mlWechatOpen/src/main/java/com/iformall/controller/WechatCalllbackController.java +++ b/mlWechatOpen/src/main/java/com/iformall/controller/WechatCalllbackController.java @@ -196,8 +196,6 @@ public class WechatCalllbackController extends BaseController { appId, openid, signature, encType, msgSignature, timestamp, nonce, resultxml); - WxAppinfo appinfo = appinfoService.getByAppId(appId); - String out = ""; // aes加密的消息 WxMpXmlMessage inMessage = WxOpenXmlMessage.fromEncryptedMpXml(resultxml, @@ -228,8 +226,16 @@ public class WechatCalllbackController extends BaseController { } catch (WxErrorException e) { logger.error("callback", e); } + + PrintWriter printWriter = response.getWriter(); + printWriter.print("success"); + printWriter.flush(); + printWriter.close(); + return; } + WxAppinfo appinfo = appinfoService.getByAppId(appId); + PrintWriter printWriter = response.getWriter(); if(appinfo.getType().equals(EnumAppType.B.getCode()) ||