1166544 / wechat-share-api

基于egg.js微信分享API封装

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

基于egg.js微信分享API封装

开发

npm i
npm run serve

API访问

1.地址:
http://localhost:7001/api/service/getWeChatSignature

2.方式: POST

3.请求参数: 
{
     link: 'https://www.yourdomain.com/montage/index.html',              // 分享链接
     imgUrl: 'https://www.yourdomain.com/montage/images/cover.jpg',      // 分享封面图片
     title: '你的分享标题',                                               // 分享标题
     desc: '一些描述...'                                                  // 分享描述
}

4.返回结果:
{
    "code":200,
    "message":"请求成功",
    "data":{
        "wxAccountInfo":{
            "appId":"your app id",      // appid
            "timestamp":1519265659,     // 时间截
            "nonceStr":"M4vhCXM",       // 加密字符串
            "signature":"your signature no like.. f5617cf42f"    // 比对签名
        },
        "wxShareInfo":{
            "imgUrl":"https://mp.yourdomain.com/montage/images/cover.jpg",  // 分享封面地址
            "link":"https://mp.yourdomain.com/montage/index.html",          // 分享链接地址
            "desc":"一此描述。。。",                                         // 分享描述
            "title":"分享标题"                                              // 分享标题  
        }
    }
}

签名配置

    // config.default.js
    config.weChatShare = {
        appId: 'your appid',            // appid
        appsecret: 'your app scret',    // appscret
    }

前端调用示例

请参考client目录

预览

API Preview Gif 1

参考:

https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115

About

基于egg.js微信分享API封装


Languages

Language:JavaScript 97.5%Language:HTML 2.5%