我参考了几个网站
我做了什么:
我安装了node-taobao-topclient
我的代码:
TopClient = require('node-taobao-topclient');
const client = new TopClient({
'appkey': 'xxxx',
'appsecret': 'xxxxx',
'REST_URL': 'http://gw.api.taobao.com/router/rest'
});
client.execute('taobao.wlb.imports.general.consign', {
"session" : "620260160ZZ61473fc31270a2c1f5dcc0efdff78b4c58312482635690",
'trade_order_id':'245033103766976',
'resource_id':'5044440108577',
'store_code':'Tran_Store_775585',
'first_logistics':'123',
'first_waybillno':'123',
'sender_id':'228',
'cancel_id':'228'
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})
当我运行上面的代码时,我得到错误:
TypeError:TopClient 不是构造函数
由于我是节点新手,所以我不知道如何像在参考网站上那样准确地使用这样的包,他们正在使用它,例如:
TopClient = require('./topClient').TopClient;
我的 node-taobao-topclient 包如下所示:
任何有关如何在节点中使用此 API 的指导将不胜感激。