dev --- 3.8.0.A版本, openProject引用 ; formao-live --- 3.7.0.B 版本, formallProject引用
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
Daniel Qian fcee58ecf4 rename artifact id há 10 anos
src 微信消息路由器,及单元测试代码 há 10 anos
.gitignore 添加客服消息接口 há 10 anos
LICENSE Initial commit há 10 anos
README.md readme há 10 anos
pom.xml rename artifact id há 10 anos

README.md

weixin-tools

微信java开发工具,本项目提供了两个主要特性:微信消息路由器、微信Java API

微信消息路由器

你可以使用WxMessageRouter来对微信推送过来的消息、事件进行路由,交给特定的WxMessageHandler处理。

使用方法:

WxMessageRouter router = new WxMessageRouter();
router
  .rule()
      .msgType("MSG_TYPE").event("EVENT").eventKey("EVENT_KEY").content("CONTENT")
      .interceptor(interceptor, ...).handler(handler, ...)
  .end()
  .rule()
      // 另外一个匹配规则
  .end()
;

// 将WxXmlMessage交给消息路由器
router.route(message);
  1. 开发人员需实现自己的WxMessageHandlerWxMessageInterceptor
  2. 配置路由规则时要按照从细到粗的原则,否则可能消息可能会被提前处理
  3. 默认情况下消息只会被处理一次,除非使用 {@link Rule#next()}
  4. 规则的结束必须用{@link Rule#end()}或者{@link Rule#next()},否则不会生效

微信Java API

使用WxService可以调用微信API。目前实现了以下功能,其余功能以后陆续补充:

  1. 发送客服消息
  2. 创建自定义菜单
  3. 删除自定义菜单
  4. 查询自定义菜单
  5. 刷新access_token

如何执行单元测试

src/test/resources/test-config.sample.xml 改成 test-config.xml 设置appId, secret, accessToken(可选), openId

mvn clean test