接口:/wxa/business/performance/boot 为啥一直返回 47001 ?
获取小程序启动性能,运行性能等数据。
const wxAxios = axios.create({ baseURL: 'https://api.weixin.qq.com/' });
/**
* 47001 data format error hint
* data format error hint: [DiBDN8ore-PYfBWa] rid: 62eb8c9b-3a4ac09c-6c4a6088
*/
async function getPerformanceData(token) {
const url = `/wxa/business/performance/boot?access_token=${token}`;
const d = {
time: {
end_timestamp: dayjs().subtract(7, 'day').unix(),
start_timestamp: dayjs().subtract(24, 'day').unix()
},
module: '10021',
params: [
{
field: 'networktype',
value: '-1'
},
{
field: 'device_level',
value: '-1'
},
{
field: 'device',
value: '-1'
}
]
};
/**
* d2 是官方 请求数据示例
*/
const d2 = {
time: {
end_timestamp: 1609689600,
begin_timestamp: 1609603200
},
module: '10022',
params: [
{
field: 'networktype',
value: 'wifi'
},
{
field: 'device_level',
value: '1'
},
{
field: 'device',
value: '1'
}
]
};
/**
* 此处无论是否使用 stringify, 返回结果都是 47001
* 此处无论是否定义 headers, 返回结果都是 47001
* 此处无论使用 d 或者 d2, 返回结果都是 47001
*/
const { data } = await wxAxios.post(url, d, {
headers: {
'Content-Type': 'application/json'
}
});
console.log('getPerformanceData 返回结果', data);
return data;
}