首页 > 其他 > 详细

异步请求与合并

时间:2021-07-01 14:43:08      阅读:29      评论:0      收藏:0      [点我收藏+]
/**
* 获取cpu利用率和温度
*/
async function getCpuUsageAndTempData (data) {
const cpuUsage = await getCpuUsageData(data)
const cpuTemp = await getCpuTemperatureData(data)
let cpuData = {usage: 0, temperature: 0}
if (cpuUsage.data && cpuUsage.data.cpuUsage) {
cpuData.usage = cpuUsage.data.cpuUsage
}
if (cpuTemp.data && cpuTemp.data.currentTemperature) {
cpuData.temperature = cpuTemp.data.currentTemperature
}
return Promise.resolve(cpuData)
}

/**
* 查询设备CPU使用率
*/
function getCpuUsageData (data) {
return instance({
url: baseUrl + cpuInfoConf.getCpuUsageUrl,
method: ‘get‘,
params: data
})
}


/**
* 查询设备进程使用CPU明细
*/
function getCpuHtopData (data) {
return instance({
url: baseUrl + cpuInfoConf.getCpuHtopUrl,
method: ‘get‘,
params: data
})
}



异步请求与合并

原文:https://www.cnblogs.com/wsb20200618/p/14957914.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!