app.js ` app.use(express.query()); app.use('/wechat', wechat(config, function (req, res, next) { // 微信输入信息都在req.weixin上 var message = req.weixin; if (message.FromUserName === '屌丝') { // 回复屌丝(普通回复) res.reply('hehe'); } else if (message.FromUserName === 'text') { //你也可以这样回复text类型的信息 res.reply({ content: 'text object', type: 'text' }); } else if (message.FromUserName === '呵呵') { // 回复一段音乐 res.reply({ type: "music", content: { title: "来段音乐吧", description: "一无所有", musicUrl: "http://mp3.com/xx.mp3", hqMusicUrl: "http://mp3.com/xx.mp3", thumbMediaId: "thisThumbMediaId" } }); } else { // 回复高富帅(图文回复) res.reply([ { title: '你来我家接我吧', description: '这是女神与高富帅之间的对话', picurl: 'http://nodeapi.cloudfoundry.com/qrcode.jpg', url: 'http://nodeapi.cloudfoundry.com/' } ]); } })); ``` app.listen(7500,function(){ console.log('listen 7500') }) ``` ` 下面验证服务器 没问题 7500 和 80 端口绑定了 routes/index.js ` router.get('/', function(req, res, next) { console.log(req.url) var query = req.query; ``` var signature = query.signature; var echostr = query.echostr; var timestamp = query['timestamp']; var nonce = query.nonce; var oriArray = new Array(); oriArray[0] = nonce; oriArray[1] = timestamp; oriArray[2] = "tujiaowechat";//这里是你在微信开发者中心页面里填的token,而不是**** oriArray.sort(); var original = oriArray.join(''); console.log("Original str : " + original); console.log("Signature : " + signature ); var scyptoString = sha1(original); if(signature == scyptoString){ res.end(echostr); console.log("Confirm and send echo back"); }else { res.end("false"); console.log("Failed!"); } ``` }); ` 接口配置也成功了 http://xxxx:7500 没问题 但是发送消息没有反应 项目是用express-generate 生成的 求解。。。 谢主隆恩