We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'use strict'; const wechat = require('co-wechat'); module.exports = app => { class HomeController extends app.Controller { } // 因为 Egg 需要用类的形式来组织,而 wechat 是通过 middleware 方法来生成中间件 HomeController.prototype.wechat = wechat({ token: '', appid: '', encodingAESKey: '' }).middleware(async (message, ctx) => { // TODO var content = message.Content; var reply = '无法回复您的内容: ' + content; if (message.MsgType === 'event') { if (message.Event === 'subscribe') { if (message.EventKey) { //扫描二维码事件 console.log('扫描二维码进入...'); } reply = 'Thanks to subscribe. \r\n'; } else if (message.Event === 'unsubscribe') { // 取消关注 console.log('取消关注。。。'); reply = ''; } } else if (message.MsgType === 'text') { // 用户输入文本选项 switch (content) { case '1': reply = '您当前选项为 1。' break; case '2': reply = '您当前选项为 2。' break; case '3': reply = '您当前选项为 3。' break; default: break; } return reply; } await next(); }); return HomeController; };
我用了微信公众平台接口调试工具进行调试,基础支持返回access_token,消息接口测试返回的是请求失败,手机上也是返回服务出现故障,刚刚上手egg.js,请问是哪里出现了问题?
重新修改了下代码
The text was updated successfully, but these errors were encountered:
请按文档写。
Sorry, something went wrong.
需要填写appsecret在config里面吗? 还是之前就需要验证? 同样的代码我用ngrok + 微信测试号可以自动回复,但是部署到heroku后还是返回服务出现故障?想问下可能是什么原因?
上面的代码明显是写得不对的
egg 的集成有问题啊,一直调试不通
No branches or pull requests
我用了微信公众平台接口调试工具进行调试,基础支持返回access_token,消息接口测试返回的是请求失败,手机上也是返回服务出现故障,刚刚上手egg.js,请问是哪里出现了问题?
重新修改了下代码
The text was updated successfully, but these errors were encountered: