获取小程序启动性能,运行性能等数据。
const wxAxios = axios.create({ baseURL: 'https://api.weixin.qq.com/' });
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'
}
]
};
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'
}
]
};
const { data } = await wxAxios.post(url, d, {
headers: {
'Content-Type': 'application/json'
}
});
console.log('getPerformanceData 返回结果', data);
return data;
}
解决了吗 ?