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 🙏

© 2026 – Pkg Stats / Ryan Hefner

strapi-plugin-wechat-miniprogram

v1.0.11

Published

A Strapi v5 plugin for WeChat Mini Program APIs. This plugin creates a collection table WechatUser and a simple table WechatConfig. The WechatUser table stores WeChat user information, with a user field linking to the wechat_user relation in the User tabl

Readme

Langauge

English 中文

Description

A Strapi v5 plugin for WeChat Mini Program APIs. This plugin creates a collection table WechatUser and a simple table WechatConfig. The WechatUser table stores WeChat user information, with a user field linking to the wechat_user relation in the User table. The WechatConfig table stores WeChat Mini Program configuration, such as appId and appSecret.

Installation

npm i strapi-plugin-wechat-miniprogram

WeChat Login

  • Method:POST
  • Path:STRAPI_URL/api/strapi-plugin-wechat-miniprogram/login
  • body parameters:

| Parameter | Type | Required | | ------------ | ------------ | :----------: | | openidCode | string | √ | | phoneCode | string | |

  • Permission public

When only openidCode is provided, a user will be created with openid as the primary key.

{
    "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NywiaWF0IjoxNzYzNzkxNjMyLCJleHAiOjE3NjYzODM2MzJ9.xoZjtImtn1klQoLL5Xrrcvcy5KnPFDMaHvcAHGUtx0c",
    "user": {
        "id": 7,
        "documentId": "bavikfbi4okjwoc5qq720x56",
        "username": "obDKA13HPuz9C5BWppYpRm1uJ9Cs",
        "email": "[email protected]",
        "provider": null,
        "confirmed": true,
        "blocked": false,
        "createdAt": "2025-11-20T09:57:03.063Z",
        "updatedAt": "2025-11-20T09:57:03.063Z",
        "publishedAt": "2025-11-20T09:57:02.997Z"
    }
}

When both openidCode and phoneCode are provided, a user will be created with the phone number as the primary key.

{
    "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTEsImlhdCI6MTc2Mzk3MTIwNCwiZXhwIjoxNzY2NTYzMjA0fQ.rZ0_9gBILUl25TNAQSXnPmJ2Je2ZrhV45D2kdX66IZY",
    "user": {
        "id": 11,
        "documentId": "jrzss6zc1gas8toy9ddhzy27",
        "username": "XXXXXXXXXXX",
        "email": "[email protected]",
        "provider": null,
        "confirmed": true,
        "blocked": false,
        "createdAt": "2025-11-24T08:00:04.572Z",
        "updatedAt": "2025-11-24T08:00:04.572Z",
        "publishedAt": "2025-11-24T08:00:04.502Z"
    }
}

Get Phone Number

The code for obtaining a phone number is obtained differently from the code retrieved via wx.login().

uniapp

<template>
    <button open-type="getPhoneNumber" @getphonenumber="getphonenumber">获取手机号</button>
</template>

<script setup lang="ts">
const getphonenumber = (e) => {
    const code = e.detail.code
}
</script>
  • Method:POST
  • Path:STRAPI_URL/api/strapi-plugin-wechat-miniprogram/getPhoneNumber
  • body parameters:

| Parameter | Type | Required | | ------------ | ------------ | :----------: | | code | string | √ |

  • Permission: public

Response is consistent with the official WeChat documentation.

{
    "errcode": 0,
    "errmsg": "ok",
    "phone_info": {
        "phoneNumber": "XXXXXXXXXXX",
        "purePhoneNumber": "XXXXXXXXXXX",
        "countryCode": "86",
        "watermark": {
            "timestamp": 1763791978,
            "appid": "wxXXXXXXXXXXXX"
        }
    }
}

Get openid

  • Method:POST
  • Path:STRAPI_URL/api/strapi-plugin-wechat-miniprogram/auth/openid
  • body parameters:

| Parameter | Type | Required | | ------------ | ------------ | :----------: | | code | string | √ |

  • Permission: public

Response is consistent with the official WeChat documentation.

{
    "session_key": "kkniNl6BcQVLFIoM37vg8g==",
    "openid": "obDKA13HPuz9C5BWppYpRm1uJ9Cs"
}

Update User Info

  • Method:POST
  • Path: STRAPI_URL/api/strapi-plugin-wechat-miniprogram/auth/update
  • Header:Authorization: Bearer USER_TOKEN
  • body parameters:

| Parameter | Type | Required | | ------------ | ------------ | ------------ | | nickname | string | | | avatar | string | | | phone | string | |

  • Permission: Authenticated
{
    "code": 0,
    "message": "更新成功",
    "data": {
        "id": 9,
        "documentId": "mmr74jzbknf740spef1vka6m",
        "openid": "obDKA13HPuz9C5BWppYpRm1uJ9Cs",
        "nickname": "理塘策马大王",
        "avatar": null,
        "phone": null,
        "createdAt": "2025-11-20T09:57:03.073Z",
        "updatedAt": "2025-11-22T06:17:46.975Z",
        "publishedAt": "2025-11-22T06:17:46.985Z",
        "locale": null
    }
}

简介

适用于 strapi v5 微信小程序 api 插件
此插件会创建一个集合表 WechatUser 和一个简单表 WechatConfig,其中 WechatUser 表为微信用户表,字段 user 与 User 表 wechat_user 关联;WechatConfig 表为微信小程序配置,可设置 appId 和 appSecret。

安装

npm i strapi-plugin-wechat-miniprogram

微信登录

  • 方法:POST
  • 路径:STRAPI_URL/api/strapi-plugin-wechat-miniprogram/login
  • body 参数:

| 参数名 | 类型 | 是否必须 | | ------------ | ------------ | :----------: | | openidCode | string | √ | | phoneCode | string | |

  • 权限: public

仅带有 openidCode 参数时会以 openid 为主键创建用户

{
    "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NywiaWF0IjoxNzYzNzkxNjMyLCJleHAiOjE3NjYzODM2MzJ9.xoZjtImtn1klQoLL5Xrrcvcy5KnPFDMaHvcAHGUtx0c",
    "user": {
        "id": 7,
        "documentId": "bavikfbi4okjwoc5qq720x56",
        "username": "obDKA13HPuz9C5BWppYpRm1uJ9Cs",
        "email": "[email protected]",
        "provider": null,
        "confirmed": true,
        "blocked": false,
        "createdAt": "2025-11-20T09:57:03.063Z",
        "updatedAt": "2025-11-20T09:57:03.063Z",
        "publishedAt": "2025-11-20T09:57:02.997Z"
    }
}

同时带有 openidCodephoneCode 参数以手机号为主键创建用户

{
    "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTEsImlhdCI6MTc2Mzk3MTIwNCwiZXhwIjoxNzY2NTYzMjA0fQ.rZ0_9gBILUl25TNAQSXnPmJ2Je2ZrhV45D2kdX66IZY",
    "user": {
        "id": 11,
        "documentId": "jrzss6zc1gas8toy9ddhzy27",
        "username": "XXXXXXXXXXX",
        "email": "[email protected]",
        "provider": null,
        "confirmed": true,
        "blocked": false,
        "createdAt": "2025-11-24T08:00:04.572Z",
        "updatedAt": "2025-11-24T08:00:04.572Z",
        "publishedAt": "2025-11-24T08:00:04.502Z"
    }
}

获取手机号

注意,获取手机号的code与wx.login()获取的code不是同一方式。

uniapp

<template>
    <button open-type="getPhoneNumber" @getphonenumber="getphonenumber">获取手机号</button>
</template>

<script setup lang="ts">
const getphonenumber = (e) => {
    const code = e.detail.code
}
</script>
  • 方法:POST
  • 路径:STRAPI_URL/api/strapi-plugin-wechat-miniprogram/getPhoneNumber
  • body 参数:

| 参数名 | 类型 | 是否必须 | | ------------ | ------------ | :----------: | | code | string | √ |

  • 权限: public

响应结果等同于微信官方文档

{
    "errcode": 0,
    "errmsg": "ok",
    "phone_info": {
        "phoneNumber": "XXXXXXXXXXX",
        "purePhoneNumber": "XXXXXXXXXXX",
        "countryCode": "86",
        "watermark": {
            "timestamp": 1763791978,
            "appid": "wxXXXXXXXXXXXX"
        }
    }
}

获取openid

  • 方法:POST
  • 路径:STRAPI_URL/api/strapi-plugin-wechat-miniprogram/auth/openid
  • body 参数:

| 参数名 | 类型 | 是否必须 | | ------------ | ------------ | :----------: | | code | string | √ |

  • 权限: public

响应结果等同于微信官方文档

{
    "session_key": "kkniNl6BcQVLFIoM37vg8g==",
    "openid": "obDKA13HPuz9C5BWppYpRm1uJ9Cs"
}

更改信息

  • 方法:POST
  • 路径: STRAPI_URL/api/strapi-plugin-wechat-miniprogram/auth/update
  • 请求头:Authorization: Bearer USER_TOKEN
  • body 参数:

| 参数名 | 类型 | 是否必须 | | ------------ | ------------ | ------------ | | nickname | string | | | avatar | string | | | phone | string | |

  • 权限: Authenticated
{
    "code": 0,
    "message": "更新成功",
    "data": {
        "id": 9,
        "documentId": "mmr74jzbknf740spef1vka6m",
        "openid": "obDKA13HPuz9C5BWppYpRm1uJ9Cs",
        "nickname": "理塘策马大王",
        "avatar": null,
        "phone": null,
        "createdAt": "2025-11-20T09:57:03.073Z",
        "updatedAt": "2025-11-22T06:17:46.975Z",
        "publishedAt": "2025-11-22T06:17:46.985Z",
        "locale": null
    }
}