https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141016
修改/Weixin/src/com/imooc/servlet/WeixinServlet.java
}else if(MessageUtil.MESSAGE_EVENT.equals(msgType)){
String eventType = map.get("Event");
if(MessageUtil.MESSAGE_SUBSCRIBE.equals(eventType)){
message = MessageUtil.initText(toUserName, fromUserName, MessageUtil.menuText());
}else if(MessageUtil.MESSAGE_CLICK.equals(eventType)){
message = MessageUtil.initText(toUserName, fromUserName, MessageUtil.menuText());
}else if(MessageUtil.MESSAGE_VIEW.equals(eventType)){
String url = map.get("EventKey");
message = MessageUtil.initText(toUserName, fromUserName, url);
}else if(MessageUtil.MESSAGE_SCANCODE.equals(eventType)){
String key = map.get("EventKey");
message = MessageUtil.initText(toUserName, fromUserName, key);
}
}
然后,打个断点
手机上传一个位置
自动进入断点
点击 Yes
{
MsgId=6590193103541440508,
FromUserName=o3ipE510IqpHyFKPN-hLMDqBn1PI,
CreateTime=1534398902,
Label=上海市徐汇区虹桥路693弄1-39号,
Scale=15,
Location_X=31.195641,
ToUserName=gh_02ced66d8cc2,
Location_Y=121.425498,
MsgType=location
}
}else if(MessageUtil.MESSAGE_EVENT.equals(msgType)){
String eventType = map.get("Event");
if(MessageUtil.MESSAGE_SUBSCRIBE.equals(eventType)){
message = MessageUtil.initText(toUserName, fromUserName, MessageUtil.menuText());
}else if(MessageUtil.MESSAGE_CLICK.equals(eventType)){
message = MessageUtil.initText(toUserName, fromUserName, MessageUtil.menuText());
}else if(MessageUtil.MESSAGE_VIEW.equals(eventType)){
String url = map.get("EventKey");
message = MessageUtil.initText(toUserName, fromUserName, url);
}else if(MessageUtil.MESSAGE_SCANCODE.equals(eventType)){
String key = map.get("EventKey");
message = MessageUtil.initText(toUserName, fromUserName, key);
}
}else if(MessageUtil.MESSAGE_LOCATION.equals(msgType)){
String label = map.get("Label");
message = MessageUtil.initText(toUserName, fromUserName, label);
}
System.out.println(message);
手机上传位置,可以返回位置信息