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

@re-ai/inner-tool-sdk

v0.4.1

Published

ReAI内部接口sdk

Readme

ReAI 内部接口 sdk

更新

  • 2024.08.16

    • 添加硬件MQTT接口, 文档
  • 2024.07.24

    • 添加微信小程序码获取接口
  • 2024.07.19

    • 添加微信小程序获取手机号码接口
  • 2024.07.16

    • 添加小程序支付下单接口支持,下单参数添加 platform="mini", appid=[绑定微信支付的appid],
  • 2024.07.12

    • 添加文件上传管理接口, 文档
  • 2024.07.08

    • 添加快递快递查询接口
  • 2024.07.05

    • 添加微信支付退款接口
  • 2024.07.01

    • 微信支付添加jsapi类型下单,参数添加openid(可选),不传入openid公众号去授权获取
  • 2024.06.30

    • 添加AI翻译seamless接口
  • 2024.06.19

  • 2024.06.17

    • 添加文本处理(快递地址解析,支持阿里云,百度接口,已测试)
    • 添加硬件ws消息的处理个发送,文档
  • 2024.06.07

使用方法

安装

npm i @re-ai/inner-tool-sdk

环境变量

| 环境变量 | 描述 | 默认值 | | ------------- | ------------------- | ------------------------ | | RPC_PORT_SMS | 短信服务端口 | 4682 | | RPC_HOST_SMS | 短信服务地址 | 127.0.0.1 | | RPC_PORT_PAY | 支付服务端口 | 4681 | | RPC_HOST_PAY | 支付服务地址 | 127.0.0.1 | | RPC_PORT_TEXT | 文本处理端口 | 4683 | | RPC_HOST_TEXT | 文本处理地址 | 127.0.0.1 | | RPC_PORT_EXPRESS | 文本处理地址 | 4684 | | RPC_HOST_EXPRESS | 文本处理地址 | 127.0.0.1 | | ONE_API_HOST | one-api 服务地址 | | | ONE_API_TOKEN | one-api 管理员token | (只在管理员模式下生效) | | REAI_MQTT_API_BASE_URL| mqtt服务地址 | https://hd.cn.reai.com/api |

示例

one-api接口

import { ReAITool } from '@re-ai/inner-tool-sdk'

// 管理员接口
// 使用管理员接口设置环境变量 ONE_API_HOST 和 ONE_API_TOKEN,获取通过初始化参数传入
ReAITool.oneapi().admin().channelList()

// 用户接口
// 使用用户接口设置环境变量 ONE_API_HOST
// register, login 不需要传token
ReAITool.oneapi().user().register()
ReAITool.oneapi().user().login()

// 其他用户接口,推荐在初始化参数中传入
ReAITool.oneapi({token}).user().self()

短信

import { ReAITool, SMSPlatforms } from '@re-ai/inner-tool-sdk'

// 发送短信
ReAITool.sms().smsCodeSend({
    platform: SMSPlatforms.ALI,
    mobile: "xxxxxxxx"
})

// 验证短信
ReAITool.sms().smsCodeVerify({
    mobile: "xxxxxxxx",
    code: "xxxxxxxx"
})

支付

import { ReAITool, SMSPlatforms } from '@re-ai/inner-tool-sdk'

// 生成支付订单
ReAITool.pay().create({
  ...
})

文本处理

import { ReAITool, TextPlatform } from '@re-ai/inner-tool-sdk'

ReAITool.text().address({
    platform: TextPlatform.ALIYUN,
    text: "需要处理的地址文本"
}).then(res => {
    console.log(res);
})

物流查询

import { ReAITool } from '@re-ai/inner-tool-sdk'
ReAITool.express().query({
  no: "物流单号"
})

支付接口

方法

create(data: PayOrderCreateData): Promise<RPCClientResponseResult<PayOrderInfo>>

创建新的支付订单。

  • 参数:
    • data (PayOrderCreateData): 包含订单创建数据的对象。
      • orderNo (string): 唯一订单号。
      • amount (number): 订单总金额。
      • desc (string): 订单描述。
      • ip (string): 发起订单的IP地址。
      • type (PayType): 支付类型(wxpay 微信支付或 alipay 支付宝支付)。
      • platform ("pc" | "h5" | "jsapi"): 发起订单的平台。
      • returnUrl (string?): 支付成功后重定向的URL。
      • notifyUrl (string?): 接收支付通知的URL。

get(orderNo: string): Promise<RPCClientResponseResult<PayOrderInfo>>

获取现有订单的详细信息。

  • 参数:
    • orderNo (string): 订单的唯一标识符。

refundCreate(data: PayOrderRefundCreateData): Promise<RPCClientResponseResult<PayOrderRefundCreateInfo>>

创建退款申请

  • 参数:
    • data (PayOrderRefundCreateData): 包含退款申请数据的对象。
      • orderNo (string): 唯一订单号。
      • amount (number): 退款金额。
      • reason (string?): 退款原因。

refundInfo(orderNo: string): Promise<RPCClientResponseResult<PayOrderRefundInfo>>]

退款详情

  • 参数:
    • orderNo (string): 订单的唯一标识符。

短信接口

方法

smsCodeSend(data: SMSSendArgs): Promise<RPCClientResponseResult<SMSSendRes>>

发送短信验证码。

  • 参数:
    • data (SMSSendArgs): 包含发送短信数据的对象。
      • mobile (string): 将发送短信的手机号码。
      • platform (SMSPlatforms): 将使用的短信平台(ali 阿里云或 tx 腾讯云)。

smsCodeVerify(data: SMSVerifyArgs): Promise<RPCClientResponseResult<undefined>>

验证用户接收到的短信验证码。

  • 参数:
    • data (SMSVerifyArgs): 包含验证数据的对象。
      • mobile (string): 与短信验证码相关联的手机号码。
      • code (string): 要验证的验证码。

枚举和类型

PayType

定义支付系统的类型。

  • wxpay: 微信支付
  • alipay: 支付宝支付

SMSPlatforms

定义发送短信的平台。

  • ali: 阿里云
  • tx: 腾讯云

文本处理接口

方法

address(data: TextAddressArgs): Promise<RPCClientResponseResult<TextAddressResult>>

  • 参数
    • data (TextAddressArgs): 包含文本处理数据的对象。
      • platform (TextPlatform): 文本处理平台(ali 阿里云或 tx 腾讯云)。
      • text (string): 要处理的文本。

枚举和类型

TextPlatform

定义文本处理系统的类型。

  • aliyun: 阿里云
  • baidu: 百度

物流接口

方法

query(data: ExpressQueryReqData): Promise<RPCClientResponseResult<ExpressQueryResData>>

物流查询

  • 参数
    • data (ExpressQueryReqData): 包含查询数据的对象。
      • number (string) 物流单号。
      • mobile? (string): 手机号。
      • expressCode? (string): 物流公司code。