1 Star 4 Fork 0

شەرەر / sherer-wechat-utils

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

sherer-wechat-utils

微信小程序和公众号便捷程序

WechatSalon 的使用方法

const { WechatSalon } = require('sherer-wechat-utils');

const token = "Your token"; // 小程序或公众号的令牌(Token)
const appid = "Your appid"; // 小程序或公众号的AppId(安全模式时必要)
const encodingAESKey = "Your encodingAESKey"; // 小程序或公众号的消息加解密密钥(encodingAESKey, 安全模式时必要)

let result;
let salon = new WechatSalon(event, { appid, token, encodingAESKey });
let check = await salon.run({
    subscribe: async res => { // 关注事件
        // 您的逻辑代码
        result = salon.getText("欢迎关注");
    },
    unsubscribe: async res => { // 取消关注事件
        // 您的逻辑代码
    },
    Scan: async res => { // 扫码事件
        // 您的逻辑代码
    },
    Location: async res => { // 上报地理位置事件
        // 您的逻辑代码
    },
    Click: async res => { // 自定义菜单点击事件
        // 您的逻辑代码
    },
    View: async res => { // 自定义菜单跳转事件
        // 您的逻辑代码
    },
    TemplateSendJobFinish: async res => { // 模板消息发送任务完成事件
        // 您的逻辑代码
    },
    ViewMiniProgram: async res => { // 跳转小程序事件
        // 您的逻辑代码
    },
    text: async res => { // 文本消息
        // 您的逻辑代码
        result = salon.getImage("图片 mediaId");
    },
    image: async res => { // 图片消息
        // 您的逻辑代码
    },
    voice: async res => { // 语音消息
        // 您的逻辑代码
    },
    video: async res => { // 视频消息
        // 您的逻辑代码
    },
    shortvideo: async res => { // 短视频消息
        // 您的逻辑代码
    },
    location: async res => { // 位置消息
        // 您的逻辑代码
    },
    link: async res => { // 链接消息
        // 您的逻辑代码
    },
});

return check || result;

空文件

简介

微信小程序和公众号便捷程序 展开 收起
JavaScript
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/Sherer/sherer-wechat-utils.git
git@gitee.com:Sherer/sherer-wechat-utils.git
Sherer
sherer-wechat-utils
sherer-wechat-utils
master

搜索帮助