2017-06-10 17:18

@杜福忠 /**
* 实现父类抽方法,处理自定义菜单事件
*/
protected void processInMenuEvent(InMenuEvent inMenuEvent) {
logger.debug("菜单事件:" + inMenuEvent.getFromUserName());
OutTextMsg outMsg = new OutTextMsg(inMenuEvent);

if ("scancode_waitmsg".equals(inMenuEvent.getEvent())) {
System.out.println("菜单事件内容是:" + inMenuEvent.getEventKey());
System.out.println("内容是:" + inMenuEvent.getScanCodeInfo().getScanResult().toString());
String scanResult = inMenuEvent.getScanCodeInfo().getScanResult().toString();
outMsg.setContent("菜单事件内容是:" + inMenuEvent.getEventKey());
render(outMsg);
} else if ("CLICK".equals(inMenuEvent.getEvent())) {
OutNewsMsg outNewsMsg = new OutNewsMsg();
System.out.println("菜单事件内容是:" + inMenuEvent.getEventKey());
outNewsMsg.addNews("JFinal 2.0 发布,JAVA 极速 WEB+ORM 框架", "本星球第一个极速开发框架",
"https://mmbiz.qlogo.cn/mmbiz/KJoUl0sqZFS0fRW68poHoU3v9ulTWV8MgKIduxmzHiamkb3yHia8pCicWVMCaFRuGGMnVOPrrj2qM13u9oTahfQ9A/0?wx_fmt=png",
"http://mp.weixin.qq.com/s?__biz=MzA4NjM4Mjk2Mw==&mid=211063163&idx=1&sn=87d54e2992237a3f791f08b5cdab7990#rd");
outNewsMsg.addNews("JFinal 1.8 发布,JAVA 极速 WEB+ORM 框架", "现在就加入 JFinal极速开发世界,节省更多时间去跟女友游山玩水 ^_^",
"http://mmbiz.qpic.cn/mmbiz/zz3Q6WSrzq1ibBkhSA1BibMuMxLuHIvUfiaGsK7CC4kIzeh178IYSHbYQ5eg9tVxgEcbegAu22Qhwgl5IhZFWWXUw/0",
"http://mp.weixin.qq.com/s?__biz=MjM5ODAwOTU3Mg==&mid=200313981&idx=1&sn=3bc5547ba4beae12a3e8762ababc8175#rd");
outNewsMsg.addNews("JFinal 1.6 发布,JAVA 极速 WEB+ORM 框架", "JFinal 1.6 主要升级了ActiveRecord 插件,本次升级全面支持多数源、多方言、多缓",
"http://mmbiz.qpic.cn/mmbiz/zz3Q6WSrzq0fcR8VmNCgugHXv7gVlxI6w95RBlKLdKUTjhOZIHGSWsGvjvHqnBnjIWHsicfcXmXlwOWE6sb39kA/0",
"http://mp.weixin.qq.com/s?__biz=MjM5ODAwOTU3Mg==&mid=200121522&idx=1&sn=ee24f352e299b2859673b26ffa4a81f6#rd");
render(outNewsMsg);
} else{
outMsg.setContent("菜单事件内容是:" + inMenuEvent.getEventKey());
render(outMsg);
}
}

直接导入的http://git.oschina.net/jfinal/jfinal-weixin-demo这个,就是把WeixinMsgController.java文件修改了处理自定义菜单事件,根据点击不同菜单走不同的流程,如果是click类型就返回多图文消息,但是不能返回addNews中的图文消息,发送给微信服务器的消息都是null了

2017-06-10 09:58

@杜福忠 但是我回复文本消息手机微信的公众测试号是能正常接收的,这表明appid和appsecret没有配置错误吧,只是我想回复图文消息就是上面截图中接收者为null