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

egg-minifapp

v1.0.7

Published

对接各种小程序之类app的sdk

Downloads

135

Readme

微信 - 抖音对应业务

前言

当前包打算是对接对应的各平台的api的集合方便开发者对该业务的使用,比如 微信小程序 - qq小程序 - 抖音小程序 - 抖音生活商家服务 - 微信公众号 - 支付宝......

当然我涉及到的业务我才去对接,当然你可以跟我们联系把你的api也对接上去方便自己维护和分享~

现在已经对接的是: 抖音生活 - 微信小程序

使用建议:建议用ts来对接,比较有很好的提示~

使用说明(例子)

yarn add minif_node(也可以npm)

//建议
import {createtiktok ,tik_tok} from 'minif_node'
//或者
const { createtiktok ,tik_tok} = require('minif_node');
let tiktok_live = createtiktok({
  appid: "申请的appid",
  appSecret: "申请的appSecret",
//可以不配置 | 不配置那么就本地缓存 
  redis_options: {
​    host: '127.0.0.1',
​    port: 6379,
​    password: '123456',
​    db: 0
  }
})

//当然你也可以 自己new 出来 比如   (但是不建议)
let tiktok_live = new tik_tok({
  appid: "申请的appid",
  appSecret: "申请的appSecret",
//可以不配置 | 不配置那么就本地缓存 
  redis_options: {
​    host: '127.0.0.1',
​    port: 6379,
​    password: '123456',
​    db: 0
  }
})
//例子 获取自己的获取这次的请求的token信息
let getAccessTokenres = await tiktok_live.getAccessToken();
//就一行那你就得到你想要的 | 还有很多请去对应的文档中查看~

微信小程序(总览)

| api名称 | 函数名 | 描述 | | :----------------------------------------------------------: | :-----------------------------------------: | :--: | | 用户授权 | | | | 获取token | getAccessToken() | | | 小程序登陆 | wxcodelogin() | | | 用户信息 | | | | 手机号验证 | getPhoneNumber() | | | 小程序码/链接 | | | | 获取不限制的小程序码 | getUnlimitedQRCode() | |

开始

import {createwxmini ,wxmini} from 'minif_node'
let wx_mini_creat = createwxmini({
  appid: "申请的appid",
  appSecret: "申请的appSecret",
//可以不配置 | 不配置那么就本地缓存 
  redis_options: {
​    host: '127.0.0.1',
​    port: 6379,
​    password: '123456',
​    db: 0
  }
})

getAccessToken()

const getAccessTokenres = await wx_mini_creat.getAccessToken()

wxcodelogin()

//code是前端生成的code
const wxcodeloginres = await wx_mini_creat.wxcodelogin(code:string)

getPhoneNumber()

//code是前端生成的验证的手机号的code
const getPhoneNumberres = await wx_mini_creat.getPhoneNumber(code:string)

getUnlimitedQRCode()

//code是前端生成的code
const getUnlimitedQRCoderes = await wx_mini_creat.getUnlimitedQRCode({
        // 最大32个可见字符,只支持数字,大小写英文以及部分特殊字符:!#$&'()*+,/:;=?@-._~,其它字符请自行编码为合法字符(因不支持%,中文无法使用 urlencode 处理,请使用其他编码方式)
    scene: string,
    // 默认是主页,页面 page,例如 pages/index/index,根路径前不要填加 /,不能携带参数(参数请放在scene字段里),如果不填写这个字段,默认跳主页面。scancode_time为系统保留参数,不允许配置
    page?: string,
    // 默认是true,检查page 是否存在,为 true 时 page 必须是已经发布的小程序存在的页面(否则报错);为 false 时允许小程序未发布或者 page 不存在, 但page 有数量上限(60000个)请勿滥用。
    check_path?: boolean,
    // 要打开的小程序版本。正式版为 "release",体验版为 "trial",开发版为 "develop"。默认是正式版。
    env_version?: string,
    //默认430,二维码的宽度,单位 px,最小 280px,最大 1280px
    width?: number,
    //自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调,默认 false
    auto_color?: boolean,
    // 默认是{"r":0,"g":0,"b":0} 。auto_color 为 false 时生效,使用 rgb 设置颜色 例如 {"r":"xxx","g":"xxx","b":"xxx"} 十进制表示
    line_color?: unknown,
    // 默认是false,是否需要透明底色,为 true 时,生成透明底色的小程序
    is_hyaline?: boolean,
})

qq小程序(总览)

| api名称 | 函数名 | 描述 | | :----------------------------------------------------------: | :-------------------------------------------: | :--: | | 用户授权 | | | | 获取token | getAccessToken() | | | 小程序登陆 | qqcodelogin() | | | 二维码与链接 | | | | 生成二维码 | getUnlimitedQRCode() | | | | | | | | | |

开始

import {createqqmini ,qqmini} from 'minif_node'
let createqqmini = createqqmini({
  appid: "申请的appid",
  appSecret: "申请的appSecret",
//可以不配置 | 不配置那么就本地缓存 
  redis_options: {
​    host: '127.0.0.1',
​    port: 6379,
​    password: '123456',
​    db: 0
  }
})

getAccessToken()

const getAccessTokenres = await createqqmini.getAccessToken()

qqcodelogin()

//code是前端生成的
const qqcodeloginres = await wx_mini_creat.qqcodelogin(code:string)

getUnlimitedQRCode()

//扫码进入的小程序页面路径,小程序不填进入首页,小游戏无需填写
const getUnlimitedQRCoderes = await wx_mini_creat.getUnlimitedQRCode(path:string)

抖音生活商家服务(总览)

| api名称 | 函数名 | 描述 | | :----------------------------------------------------------: | :----------------------------------------------------------: | :-------------------------: | | 用户授权 | | | | 获取token | getAccessToken() | 获取token信息 | | 门店管理 | | | | 查询门店信息 | get_poi_query() | 门店列表 | | 团队核销 | | | | 验券准备 | check_ticket_start() | 注意:这里扫码和code是重叠的 | | 验券 | check_ticket_open() | 验券数据 | | 撤销核销 | check_ticket_cancel() | | | 券状态查询 | check_ticket_certificateget() | | | 团购对账 | | | | 验券历史查询 | check_ticket_history_list() | | | 账单详细查询 | check_ticket_detailed_query() | | | 账单查询 | check_ticket_merchantquery() | | | 分账明细查询 | query_record_by_cert() | | | 订单查询 | | | | 查询订单 | get_trade_order_query() | | | 商品发布以及查询 | | | | 获取商品的数据 | get_merchandise_online_data() | | | 获取商品的数据列表 | get_merchandise_online_data_list() | |

开始

import {createtiktok ,tik_tok} from 'minif_node'
let tiktok_live = createtiktok({
  appid: "申请的appid",
  appSecret: "申请的appSecret",
//可以不配置 | 不配置那么就本地缓存 
  redis_options: {
​    host: '127.0.0.1',
​    port: 6379,
​    password: '123456',
​    db: 0
  }
})

getAccessToken()

//得到自己的token
const getAccessTokenres = await tiktok_live.getAccessToken()

get_poi_query()

const get_poi_queryres = await tiktok_live.get_poi_query({
page:1,    // 页码 ,(从1开始)
size: 20,   // 一页大小 数值范围:[1, 100]
account_id:'',//本地生活商家账户 ID(account_id和poi_id,二者必填其一,若都填写,account_id优先)
poi_id: '', // 抖音门店 ID(account_id和poi_id,二者必填其一,若都填写,account_id优先)
third_id:'',
})

check_ticket_start()

const check_ticket_startres = await tiktok_live.check_ticket_start({
    // 手输入的code
    code?: string,
    // 识别的短链的地址
    short_chain?: string,
})

check_ticket_open()

const check_ticket_openres = await tiktok_live.check_ticket_open({
    // 一次验券的标识 在验券准备中获取~
    verify_token: string,
    // 核销的抖音门店id
    poi_id: string,
    // 验券准备接口返回的加密抖音券码
    encrypted_codes?: string[],
    // 三方原始券码值列表 (encrypted_codes/codes/code_with_time_list必须三选一)
    codes?: string[],
    // 抖音侧的订单号 (非预导码模式的三方券码必需)
    order_id?: string,
    // 带有核销时间的三方码列表
    code_with_time_list?: string[],
})

check_ticket_cancel()

const check_ticket_cancelres = await tiktok_live.check_ticket_cancel({
    // 代表券码一次核销的唯一标识(验券时返回)(次卡撤销多次时请填0)
    verify_id: string,
    // 代表一张券码的标识(验券时返回)
    certificate_id: string,
    // 取消核销总次数(多次卡商品可传,优先级低于verify_id)注意:如果是分门店结算,此字段不要传!!!
    times_card_cancel_count?: number,
    // 撤销核销幂等操作,主要针对次卡,避免因超时等原因在短时间内重复请求导致撤销多次(幂等有效期1小时) 注意:如果是分门店结算,此字段不要传!!!
    cancel_token?: string,
})

check_ticket_certificateget()

const check_ticket_history_listres = await tiktok_live.check_ticket_certificateget({
    // 页大小,取值范围20
    size: number,
    // 游标,传前一页最后一条记录的游标(首页传0)
    cursor: string,
    //企业号商家总店id(验券准备接口中返回)
    account_id: string,
    //门店id列表,不传默认返回商家所有门店核销记录,多个值使用,拼接
    poi_ids?: string[],
    //起始时间戳,单位秒,不传表示今天
    start_time?: bigint,
    //截止时间戳,单位秒
    end_time?: bigint
})

check_ticket_history_list()


const check_ticket_history_listres = await tiktok_live.check_ticket_history_list({
    // 页大小,取值范围20
    size: number,
    // 游标,传前一页最后一条记录的游标(首页传0)
    cursor: string,
    //企业号商家总店id(验券准备接口中返回)
    account_id: string,
    //门店id列表,不传默认返回商家所有门店核销记录,多个值使用,拼接
    poi_ids?: string[],
    //起始时间戳,单位秒,不传表示今天
    start_time?: bigint,
    //截止时间戳,单位秒
    end_time?: bigint
})

check_ticket_detailed_query()

const check_ticket_detailed_queryres = await tiktok_live.check_ticket_detailed_query({
    //商户id
    account_id: string,
    //查询游标,第一页查询传0,翻页查使用上一次查询返回cursor
    cursor: string,
    //页大小,取值范围1~50
    size: number,
    // 核销日期,格式为"2006-01-02"
    bill_date: string,
})

check_ticket_merchantquery()

const check_ticket_merchantqueryres = await tiktok_live.check_ticket_merchantquery({
    //商户id
    account_id: string,
    //查询游标,第一页查询传0,翻页查使用上一次查询返回cursor
    cursor: string,
    //页大小,取值范围1~50
    size: number,
    // 核销日期,格式为"2006-01-02"
    bill_date: string,
})

query_record_by_cert()

const get_trade_order_queryres = await tiktok_live.query_record_by_cert({
    //券码的标识(验券时返回)列表,列表长度范围1~50,多个值使用拼接
    certificate_ids: string[],
})

get_trade_order_query()

const get_trade_order_queryres = await tiktok_live.get_trade_order_query({
    // 第几页(首页传1)
    page_num: number,
    // 页大小,取值范围1~100
    page_size: number,
    // 商户id
    account_id: string,
    // 第三方订单号
    ordequey?: string,
    // 第三方订单号
    ext_order_id?: string,
    // 抖音用户id
    open_id?: string,
    // 订单状态
    order_status?: number,
    // 创单起始时间 (秒时间戳,创单起止时间必须同时传入)
    create_order_start_time?: BigInt,
    // 创单结束时间(秒时间戳,创单起止时间必须同时传入)
    create_order_end_time?: BigInt,
    // 修改起始时间 (秒时间戳,修改起止时间必须同时传入
    update_order_start_time?: BigInt,
    // 修改起始时间(秒时间戳,修改起止时间必须同时传入)
    update_order_end_time?: BigInt,
    // 是否查询用户隐私号
    get_secret_number?: boolean,
})

get_merchandise_online_data()

const get_merchandise_online_datares = await tiktok_live.get_merchandise_online_data({
    // 商品ID列表,多个值使用,拼接
    product_ids?: string[],
    // 外部商品ID列表,多个值使用,拼接
    out_ids?: string[],
    // 商家ID,传入时服务商须与该商家满足授权关系
    account_id: string,
})

get_merchandise_online_data_list()

const get_merchandise_online_data_listres = await tiktok_live.get_merchandise_online_data_list({
    // 第一页不传,之后用前一次返回的next_cursor传入进行翻页
    cursor?: string,
    // 分页数量,不传默认为5,最大上限50
    count?: number,
    // 过滤在线状态 1-在线 2-下线 3-封禁
    status?: number,
    // 商家ID,传入时服务商须与该商家满足授权关系
    account_id: string,
    // 区分商品创建者的查询方式
    // 0 - 查询服务商/开发者创建的商品
    // 1 - 查询商家(account_id)创建的商品
    goods_creator_type?: number
})

版本介绍

| 版本号 | 版本说明 | | :----: | :-------------------------------------------------------: | | v1.1.0 | 增加对应的分账明细的,以及其他部分调整基本上在原来上升级 | | v1.0.9 | 把记录redis的信息改为字符串 && 新增抖音小程序发的部分对接 | | v1.0.8 | qq小程序和微信小程序部分对接 | | v1.0.7 | 抖音生活部分对接完毕 |

联系

如果你看到这篇包如果有什么疑问或者有什么功能缺陷或者没有但是想要对接功能,可以联系我。

微信:

qq:

赞赏

参与贡献

易沁沅