Browse Source

萤石设备指定序列号

dev
巴林闲侠 2 years ago
parent
commit
7b4de37c10
  1. 71
      api/app/lib/controllers/data/videoCenter.js
  2. 1
      web/client/src/sections/quanju/containers/footer/leadership/right/hudongVideo.js

71
api/app/lib/controllers/data/videoCenter.js

@ -31,19 +31,70 @@ function videoList (opts) {
} }
} }
const deviceRes = await app.fs.yingshiRequest.post(`lapp/device/list`, { // const deviceRes = await app.fs.yingshiRequest.post(`lapp/device/list`, {
query: { // query: {
accessToken: yingshiToken, // accessToken: yingshiToken,
} // }
}) // })
ctx.status = 200; ctx.status = 200;
ctx.body = [] || (deviceRes.data || []).map(item => {
return { let deviceRes_ = [{
...item, deviceName: '楼前大桥',
token: yingshiToken, 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) { } catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: error`); ctx.fs.logger.error(`path: ${ctx.path}, error: error`);
ctx.status = 400; ctx.status = 400;

1
web/client/src/sections/quanju/containers/footer/leadership/right/hudongVideo.js

@ -50,7 +50,6 @@ class ReactCarousel extends Component {
} }
render () { render () {
console.log(this.props);
const { imgs } = this.state const { imgs } = this.state
return ( return (
<div className="ReactCarousel" style={{ width: "100%", height: "100%" }}> <div className="ReactCarousel" style={{ width: "100%", height: "100%" }}>

Loading…
Cancel
Save