|
@ -350,7 +350,7 @@ async function getDevicesLlinkStatus (ctx, next) { |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
async function findAlarmsDevice(ctx, next) { |
|
|
async function findAlarmsDevice (ctx, next) { |
|
|
let error = { name: 'FindError', message: '告警信息获取失败' }; |
|
|
let error = { name: 'FindError', message: '告警信息获取失败' }; |
|
|
let rslt = null; |
|
|
let rslt = null; |
|
|
const { deviceId } = ctx.params; |
|
|
const { deviceId } = ctx.params; |
|
@ -396,7 +396,7 @@ async function findAlarmsDevice(ctx, next) { |
|
|
params.size = 9999; |
|
|
params.size = 9999; |
|
|
let historyAlarm = await client.search(params); |
|
|
let historyAlarm = await client.search(params); |
|
|
const timer = ctx.app.fs.timer; |
|
|
const timer = ctx.app.fs.timer; |
|
|
function filterAlarmMsg(oriMsg) { |
|
|
function filterAlarmMsg (oriMsg) { |
|
|
let msg = []; |
|
|
let msg = []; |
|
|
for (let s of oriMsg) { |
|
|
for (let s of oriMsg) { |
|
|
msg.push({ |
|
|
msg.push({ |
|
@ -454,6 +454,23 @@ async function createInvoke (ctx, next) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function getThingStatus (ctx) { |
|
|
|
|
|
let res = [] |
|
|
|
|
|
try { |
|
|
|
|
|
const { thingId } = ctx.query |
|
|
|
|
|
let res = await ctx.app.fs.craw.get('thing/status', { query: { thingId } }) |
|
|
|
|
|
ctx.status = 200 |
|
|
|
|
|
if (res) { |
|
|
|
|
|
ctx.body = JSON.parse(res) |
|
|
|
|
|
} |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`) |
|
|
|
|
|
ctx.status = 200 |
|
|
|
|
|
ctx.body = [] |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = { |
|
|
module.exports = { |
|
|
getOrganizationsStruc, |
|
|
getOrganizationsStruc, |
|
@ -466,5 +483,6 @@ module.exports = { |
|
|
findDevicesCardStatus, |
|
|
findDevicesCardStatus, |
|
|
getDevicesLlinkStatus, |
|
|
getDevicesLlinkStatus, |
|
|
findAlarmsDevice, |
|
|
findAlarmsDevice, |
|
|
createInvoke |
|
|
createInvoke, |
|
|
|
|
|
getThingStatus, |
|
|
} |
|
|
} |