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

duiba-sdk

v0.1.0

Published

The Node Sdk For 兑吧(http://www.duiba.com.cn/)

Downloads

3

Readme

duiba-sdk

duiba-sdk Build Status Dependency Status

Installation

$ npm install duiba-sdk

Document

初始化

var Duiba = require('duiba-sdk');

let appKey = 'testappkey';
let appSecret = 'testappsecret';
let timestamp = 1457409005493;

用户登录积分商城

let loginUrl = Duiba.buildUrlWithSign(
  appKey,
  appSecret,
  {
    'uid': 'plusman',
    'credits': 2000,
    'redirect': 'http://www.plusman.cn',
    'timestamp': timestamp
  }
)

// loginUrl:
// http://www.duiba.com.cn/autoLogin/autologin?uid=plusman&credits=2000&redirect=http%3A%2F%2Fwww.plusman.cn&timestamp=1457409005493&appKey=testappkey&sign=7d748e19f290bc076542d8b27442cf3c

扣除积分接口

// 解析兑吧请求体
// 取出 urlQuery 部分,用户自己实现,末尾 & 符号带不带都可,程序会做兼容
let urlQuery = 'uid=plusman&orderNum=order-for-test-1457357341453&credits=500&params=admin%40duiba.com%3A%E5%85%91%E5%90%A7&type=alipay&ip=192.168.1.100&paramsTest59=59&sign=2b7feb4bd80462efbc6b54b3315783be&timestamp=1457357341453&waitAudit=true&actualPrice=500&description=%E6%94%AF%E4%BB%98%E5%AE%9D%E8%B4%A6%E5%8F%B7%EF%BC%9Aadmin%40duiba.com%28%E5%85%91%E5%90%A7%29+%E8%BD%AC%E8%B4%A6%E5%85%85%E5%80%BC%EF%BC%9A5%E5%85%83&facePrice=500&appKey=38NRCZ798rdwpXW3ADf6gChekRzB&'
let verifyRes = Duiba.parseCreditConsume(urlQuery, appSecret);

verifyRes 返回如下格式,做具体业务操作前,请务必确认sign_pass是否为true

{
  "sign_pass": true,
  "params": {
    "uid": "plusman",
    "orderNum": "order-for-test-1457357341453",
    "credits": "500",
    "params": "[email protected]:兑吧",
    "type": "alipay",
    "ip": "192.168.1.100",
    "paramsTest59": "59",
    "sign": "2b7feb4bd80462efbc6b54b3315783be",
    "timestamp": "1457357341453",
    "waitAudit": true,
    "actualPrice": "500",
    "description": "支付宝账号:[email protected](兑吧) 转账充值:5元",
    "facePrice": "500",
    "appKey": "38NRCZ798rdwpXW3ADf6gChekRzB"
  }
}

服务器对兑吧的请求做出响应

// 成功响应
let response = Duiba.responseCreditConsume('ok', 10, {
    bizId: bizId
});

// 失败响应
let response = Duiba.responseCreditConsume('fail', 10, {
    errorMessage: 'fail 用例测试'
});

兑换结果通知接口

处理方式同扣除积分接口

let urlQuery = 'sign=8e2a9698ea70e71263e000cf21a4d180&timestamp=1457366772233&errorMessage=%E5%A4%B1%E8%B4%A5%E7%9A%84%E8%AF%9D%E8%BF%99%E9%87%8C%E4%BC%9A%E8%BF%94%E5%9B%9E%E9%94%99%E8%AF%AF%E5%8E%9F%E5%9B%A0&orderNum=order-for-test-1457357341453&paramsTest35=35&bizId=souche-coin-test-1001&success=true&appKey=38NRCZ798rdwpXW3ADf6gChekRzB&';

let verifyRes = Duiba.parseCreditNotify(urlQuery, appSecret);

服务器做出响应

let str = Duiba.responseCreditNotify();
// 返回字符串 ok

Contribute

You're welcome to make pull requests!