var dataTotal = msg.payload.total
var dataUsed = msg.payload.used
var dataBalance = msg.payload.balance
var array = msg.payload.items[0].items
var voiceTotal = -1
var voiceUsed = -1
var voiceBalance = -1
for (let i = 0; i < array.length; i++) {
const element = array[i]
if (element.ratableResourceID == 13110004) {
voiceTotal = element.ratableAmount
voiceUsed = element.usageAmount
voiceBalance = voiceTotal - voiceUsed
}
}
msg.payload = {
'voiceTotal': voiceTotal,
'voiceUsed': voiceUsed,
'voiceBalance': voiceBalance,
'dataTotal': dataTotal,
'dataUsed': dataUsed,
'dataBalance': dataBalance,
}
return msg;
改了下加下通话时间 |