本项目 fork 自 egg-mp,感谢原作者 unclexiao 的贡献。
- 小程序登录
- 小程序授权
- 小程序支付
- 推送模板消息
- 检测是否含有敏感词
- 生成二维码/小程序码
- 接入在线客服消息
- 网页授权
- 发送模板消息
- 获取用户基础信息
- 获取用户列表
- 服务号网页支付
- 前端调用JSSDK
- 获取 Component Access Token
- 获取预授权码 (PreAuthCode)
- 获取授权方信息 (QueryAuth)
- 发送客服消息
- 获取授权页 URL
$ npm i @ddn/egg-wechat --save// {app_root}/config/plugin.js
exports.wechat = {
enable: true,
package: '@ddn/egg-wechat',
};// {app_root}/config/config.default.js
exports.wechat = {
appId: '', // 公众平台应用编号
appSecret: '', // 公众平台应用密钥
mchId: '', // 商户平台商家编号
apiKey: '', // 商户支付密钥
notifyUrl: '', // 支付结果回调地址
// 开放平台第三方平台配置
componentAppId: '',
componentAppSecret: '',
componentToken: '',
componentEncodingAESKey: '',
};请查看 doc/CONFIG.md 获取更详细说明.
async login() {
const { ctx } = this;
const { code } = ctx.request.query;
// 注意命名空间变为 ctx.service.wechat.mp
let res = await ctx.service.wechat.mp.login(code);
// {
// session_key: "...",
// openid: "..."
// };
}async getAuthUrl() {
const { ctx } = this;
// 获取授权页 URL
const url = await ctx.service.wechat.component.getOAuthDomainUrl();
// ...
}- 配置项如何找到?
- 如何搭建环境?
- 如何本地调试?
- 登录与授权(获取用户信息)
- 微信支付(小程序、服务号)
- 推送消息(服务通知、模板消息)
- 生成二维码(或小程序码)
请在这里向我提出问题