批量调用 TOP 接口
参数
名称 | 类型 | 是否可选 | 含义 |
---|---|---|---|
options |
Object |
选项 | |
options.query |
Array |
请求参数数组 | |
options.query[].topOptions |
Object |
请求参数 | |
options.query[].topOptions.method |
String |
TOP 接口名称 | |
options.success |
Function |
optional |
调用成功的回调函数 |
options.error |
Function |
optional |
调用失败的回调函数 |
响应
名称 | 类型 | 是否必须返回 | 含义 |
---|---|---|---|
result |
Array |
响应对象 | |
result[].error_response |
Object |
optional |
请求发生错误时的错误对象 |
前端调用示例
QN.top.batch({ query: [ { method: 'taobao.user.seller.get', // TOP 接口名称 fields: 'nick,sex' // 除了`method`字段外,其他字段为请求的业务参数 }, { method: 'taobao.time.get' } ], success(result) { console.log(result[0]); // `taobao.user.seller.get` 的返回结果 console.log(result[1]); // `taobao.time.get` 的返回结果 }, error(error) { console.log(error); }, }).then(result => { console.log(result[0]); // `taobao.user.seller.get` 的返回结果 console.log(result[1]); // `taobao.time.get` 的返回结果 }, error => { console.log(error); });