|
|
@ -31,19 +31,70 @@ function videoList (opts) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const deviceRes = await app.fs.yingshiRequest.post(`lapp/device/list`, { |
|
|
|
query: { |
|
|
|
accessToken: yingshiToken, |
|
|
|
} |
|
|
|
}) |
|
|
|
// const deviceRes = await app.fs.yingshiRequest.post(`lapp/device/list`, {
|
|
|
|
// query: {
|
|
|
|
// accessToken: yingshiToken,
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
|
|
|
|
ctx.status = 200; |
|
|
|
ctx.body = [] || (deviceRes.data || []).map(item => { |
|
|
|
return { |
|
|
|
...item, |
|
|
|
token: yingshiToken, |
|
|
|
|
|
|
|
let deviceRes_ = [{ |
|
|
|
deviceName: '楼前大桥', |
|
|
|
deviceSerial: 'L48947105', |
|
|
|
}, { |
|
|
|
deviceName: '滁北大桥', |
|
|
|
deviceSerial: 'L48947108', |
|
|
|
}, { |
|
|
|
deviceName: '新联桥', |
|
|
|
deviceSerial: 'L48947110', |
|
|
|
}, { |
|
|
|
deviceName: '湾庄线', |
|
|
|
deviceSerial: 'L48947112', |
|
|
|
}, { |
|
|
|
deviceName: '新土线', |
|
|
|
deviceSerial: 'AA9943808', |
|
|
|
}, { |
|
|
|
deviceName: '东文大桥', |
|
|
|
deviceSerial: 'L48947087', |
|
|
|
}, { |
|
|
|
deviceName: '莲姚线', |
|
|
|
deviceSerial: 'L48947082', |
|
|
|
}, { |
|
|
|
deviceName: '荷漳公路', |
|
|
|
deviceSerial: 'L48947109', |
|
|
|
}, { |
|
|
|
deviceName: '新武大桥', |
|
|
|
deviceSerial: 'L48947086', |
|
|
|
},] |
|
|
|
|
|
|
|
const deviceState = await Promise.all(deviceRes_.map(d => { |
|
|
|
return app.fs.yingshiRequest.post(`lapp/device/info`, { |
|
|
|
query: { |
|
|
|
accessToken: yingshiToken, |
|
|
|
deviceSerial: d.deviceSerial |
|
|
|
} |
|
|
|
}) |
|
|
|
})) |
|
|
|
|
|
|
|
for (let d of deviceRes_) { |
|
|
|
let corState = deviceState.find(item => item.code == 200 && item.data && item.data.deviceSerial == d.deviceSerial) |
|
|
|
if (corState) { |
|
|
|
d.status = corState.data.status |
|
|
|
} else { |
|
|
|
d.status = 0 |
|
|
|
} |
|
|
|
}) |
|
|
|
d.token = yingshiToken |
|
|
|
} |
|
|
|
|
|
|
|
ctx.body = deviceRes_ |
|
|
|
// ||
|
|
|
|
// (deviceRes.data || []).map(item => {
|
|
|
|
// return {
|
|
|
|
// ...item,
|
|
|
|
// token: yingshiToken,
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
} catch (error) { |
|
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: error`); |
|
|
|
ctx.status = 400; |
|
|
|