use of com.github.liuweijw.business.wechat.builder.TextBuilder in project fw-cloud-framework by liuweijw.
the class SubscribeHandler method handle.
@Override
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context, WxMpService weixinService, WxSessionManager sessionManager) throws WxErrorException {
this.logger.info("新关注用户 OPENID: " + wxMessage.getFromUser());
// 获取微信用户基本信息
WxMpUser userWxInfo = weixinService.getUserService().userInfo(wxMessage.getFromUser(), null);
if (userWxInfo != null) {
// TODO 可以添加关注用户到本地
}
WxMpXmlOutMessage responseResult = null;
try {
responseResult = handleSpecial(wxMessage);
} catch (Exception e) {
this.logger.error(e.getMessage(), e);
}
if (responseResult != null) {
return responseResult;
}
try {
return new TextBuilder().build("感谢关注", wxMessage, weixinService);
} catch (Exception e) {
this.logger.error(e.getMessage(), e);
}
return null;
}
use of com.github.liuweijw.business.wechat.builder.TextBuilder in project fw-cloud-framework by liuweijw.
the class LocationHandler method handle.
@Override
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context, WxMpService wxMpService, WxSessionManager sessionManager) {
if (wxMessage.getMsgType().equals(XmlMsgType.LOCATION)) {
// TODO 接收处理用户发送的地理位置消息
try {
String content = "感谢反馈,您的的地理位置已收到!";
return new TextBuilder().build(content, wxMessage, null);
} catch (Exception e) {
this.logger.error("位置消息接收处理失败", e);
return null;
}
}
// 上报地理位置事件
this.logger.info("\n上报地理位置 。。。 ");
this.logger.info("\n纬度 : " + wxMessage.getLatitude());
this.logger.info("\n经度 : " + wxMessage.getLongitude());
this.logger.info("\n精度 : " + String.valueOf(wxMessage.getPrecision()));
return null;
}
Aggregations