me.chanjar.weixin.mp.constant.WxMpEventConstants Java Examples

The following examples show how to use me.chanjar.weixin.mp.constant.WxMpEventConstants. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WechatMpConfiguration.java    From fw-cloud-framework with MIT License 4 votes vote down vote up
@Bean
public WxMpMessageRouter router(WxMpService wxMpService) {
	final WxMpMessageRouter newRouter = new WxMpMessageRouter(wxMpService);

	// 记录所有事件的日志 (异步执行)
	newRouter.rule().handler(this.logHandler).next();

	// 接收客服会话管理事件
	newRouter.rule().async(false).msgType(XmlMsgType.EVENT).event(
			WxMpEventConstants.CustomerService.KF_CREATE_SESSION)
			.handler(this.kfSessionHandler).end();
	newRouter.rule().async(false).msgType(XmlMsgType.EVENT).event(
			WxMpEventConstants.CustomerService.KF_CLOSE_SESSION).handler(this.kfSessionHandler)
			.end();
	newRouter.rule().async(false).msgType(XmlMsgType.EVENT).event(
			WxMpEventConstants.CustomerService.KF_SWITCH_SESSION)
			.handler(this.kfSessionHandler).end();

	// 门店审核事件
	newRouter.rule().async(false).msgType(XmlMsgType.EVENT).event(
			WxMpEventConstants.POI_CHECK_NOTIFY).handler(this.storeCheckNotifyHandler).end();

	// 自定义菜单事件
	newRouter.rule().async(false).msgType(XmlMsgType.EVENT).event(MenuButtonType.CLICK)
			.handler(this.getMenuHandler()).end();

	// 点击菜单连接事件
	newRouter.rule().async(false).msgType(XmlMsgType.EVENT).event(MenuButtonType.VIEW).handler(
			this.nullHandler).end();

	// 关注事件
	newRouter.rule().async(false).msgType(XmlMsgType.EVENT).event(EventType.SUBSCRIBE).handler(
			this.getSubscribeHandler()).end();

	// 取消关注事件
	newRouter.rule().async(false).msgType(XmlMsgType.EVENT).event(EventType.UNSUBSCRIBE)
			.handler(this.getUnsubscribeHandler()).end();

	// 上报地理位置事件
	newRouter.rule().async(false).msgType(XmlMsgType.EVENT).event(EventType.LOCATION).handler(
			this.getLocationHandler()).end();

	// 接收地理位置消息
	newRouter.rule().async(false).msgType(XmlMsgType.LOCATION).handler(
			this.getLocationHandler()).end();

	// 扫码事件
	newRouter.rule().async(false).msgType(XmlMsgType.EVENT).event(EventType.SCAN).handler(
			this.getScanHandler()).end();

	// 默认
	newRouter.rule().async(false).handler(this.getMsgHandler()).end();

	return newRouter;
}