| @@ -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; } | |||
| @@ -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; | |||
| @@ -195,14 +196,46 @@ 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, | |||
| 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(); | |||
| printWriter.print("success"); | |||
| printWriter.flush(); | |||
| printWriter.close(); | |||
| return; | |||
| } | |||
| WxAppinfo appinfo = appinfoService.getByAppId(appId); | |||
| PrintWriter printWriter = response.getWriter(); | |||
| if(appinfo.getType().equals(EnumAppType.B.getCode()) || | |||
| @@ -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<WxWeappBasicSet> page = weappBasicSetService.listAsPage(weappBasicSet, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -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("未找到相关的基础设置参数"); | |||
| @@ -84,7 +84,7 @@ jasypt: | |||
| fm: | |||
| exception: false | |||
| delay: 1 | |||
| deploy: 1 | |||
| logging: | |||
| level: | |||
| @@ -78,7 +78,7 @@ wechat: | |||
| fm: | |||
| exception: true | |||
| delay: 3 | |||
| deploy: 3 | |||
| logging: | |||
| level: | |||
| @@ -0,0 +1,106 @@ | |||
| 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 | |||
| 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 | |||
| deploy: 2 | |||
| ueditor: | |||
| config: config.json | |||
| unified: true | |||
| upload-path: ./upload/ | |||
| url-prefix: "" | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall: debug | |||
| path: ./logs/admin | |||