1.0.0 • Published 4 years ago

wdt-node v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago
    this.sid = opt.sid;
    this.appKey = opt.appKey;
    this.appSecret = opt.appSecret;
    this.retryCount = opt.retryCount || 5; // 请求频率超过时重试次数
    this.timeout = opt.timeout || 10 * 1000; // 请求超时时间
    this.retryInterval = opt.retryInterval || 30 * 1000; // 请求重试间隔
    this._baseUrl = opt.baseUrl || 'http://api.wangdian.cn/openapi2/'; // 基础路径
const WDT = require('wdt').WDT;
let wdt = new WDT({
    sid: process.env.WDT_SID,
    appKey: process.env.WDT_APPKEY,
    appSecret: process.env.WDT_APPSECRET
})
wdt.call('goods_query.php', {
    start_time: '2020-08-01 00:00:00',
    end_time: '2020-08-01 00:00:00'
})
wdt.call('goods_push.php', {
    goods_list: JSON.stringify([
        {
            'goods_no': 'test0001',
            'goods_type': 1,
            'goods_name': 'test',
            'spec_list': [{
                'spec_no': 'test00010001'
            }]
        }
    ])
})
wdt.findAll('goods_query.php', {
    start_time: '2020-08-01 00:00:00',
    end_time: '2020-08-15 00:00:00'
}, 'goods_list')

wdt.eachByTime('goods_query.php', {
    start_time: '2020-08-01 00:00:00',
    end_time: '2020-08-15 00:00:00'
}, 24 * 60 * 60 * 1000, 'goods_list')
1.0.0

4 years ago