npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-wx-mp

v1.0.0

Published

微信小程序对接

Downloads

3

Readme

node-wx-mp

node 微信小程序服务端相关接口

微信文档参考地址

https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/mp-access-token/getAccessToken.html

Install 安装

use npm isntall

使用 npm 安装

npm install node-wx-mp

已对接接口(具体说明需要查看微信文档,穿参例子看获取手机号,appid,secret,access_token三个参数均无需传递,其余参数放在对象内传入即可,键名同微信参数)

code2Session: 'https://api.weixin.qq.com/sns/jscode2session',(小程序登录) getPluginOpenPId: 'https://api.weixin.qq.com/wxa/getpluginopenpid?access_token=',(获取插件用户openpid) getPhoneNumber: 'https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=',(获取手机号) getQRCode: 'https://api.weixin.qq.com/wxa/getwxacode?access_token=',(获取小程序码) getUnlimitedQRCode: 'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=',(获取不限制的小程序码) createQRCode: 'https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=',(获取小程序二维码) generateUrlLink: 'https://api.weixin.qq.com/wxa/generate_urllink?access_token=',(获取加密URLLink) generateShortLink: 'https://api.weixin.qq.com/wxa/genwxashortlink?access_token=',(获取ShortLink)

Sample example 使用说明

init Client 初始化客户端

/**
 * 初始化工具客户端
 * @author xutao
 * @param    {[String]}                 appid [小程序唯一凭证,即 AppID]
 * @param    {[String]}                 secret [小程序唯一凭证密钥,即 AppSecret]
*/
const wechatMp = require('node-wx-mp').initClient({
    appid: appid,
    secret: secret,
})

例子

获取手机号

/**
 * 获取手机号
 * @param {String} params.code [手机号获取凭证]
*/
wechatMp.getPhoneNumber({code:code})
.then(function (body){
	console.log(body);
})
.catch(function (err){
	console.log(err);
});