Browse Source

萤石状态查询

release_0.0.2
巴林闲侠 3 years ago
parent
commit
eb5bbc2758
  1. 19
      code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js
  2. 57
      code/VideoAccess-VCMP/api/app/lib/schedule/freshYingshiState.js

19
code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js

@ -43,15 +43,15 @@ async function getCameraProject (ctx, next) {
findOption.offset = page * limit
}
if (keyword) {
findOption.where.name = { $like: `%${keyword}%` }
// findOption.where.$or = [
// {
// name: { $like: `%${keyword}%` }
// },
// // {
// // serialNo: { $like: `%${keyword}%` }
// // }
// ]
// findOption.where.name = { $like: `%${keyword}%` }
findOption.where.$or = [
{
name: { $like: `%${keyword}%` }
},
// {
// serialNo: { $like: `%${keyword}%` }
// }
]
}
if (type) {
findOption.where.type = type
@ -70,6 +70,7 @@ async function getCameraProject (ctx, next) {
findOption.include.push(abilityFind)
const cameraRes = await models.Camera.findAll(findOption)
// const cameraRes = await models.Camera.findAndCountAll(findOption)
delete findOption.order
delete findOption.limit

57
code/VideoAccess-VCMP/api/app/lib/schedule/freshYingshiState.js

@ -6,34 +6,35 @@ module.exports = function (app, opts) {
// '* * 4 * * *',
'*/8 * * * * *',
async () => {
try {
// const { models } = app.fs.dc
// const { varifyYingshiBelongSecretBySerialNo, token4yingshi } = app.fs.utils
// const secretRes = await models.SecretYingshi.findAll()
// for (let s of secretRes) {
// const tokenYingshi = await token4yingshi(s.dataValues)
// // 查询所有设备
// let pageStart = 0
// let deviceList = []
// while (pageStart >= 0) {
// const deviceRes = await app.fs.yingshiRequest.post('lapp/device/list', {
// query: {
// accessToken: tokenYingshi,
// pageStart,
// pageSize: 50
// }
// })
// if (deviceRes.code == 200) {
// if (deviceRes.data.length) {
// deviceList = deviceList.concat.apply(deviceList, deviceRes.data)
// pageStart++
// } else {
// pageStart = -1
// }
// }
// }
// console.log(deviceList);
// }
const { models } = app.fs.dc
const { varifyYingshiBelongSecretBySerialNo, token4yingshi } = app.fs.utils
const secretRes = await models.SecretYingshi.findAll()
for (let s of secretRes) {
const tokenYingshi = await token4yingshi(s.dataValues)
// 查询所有设备
let pageStart = 0
let deviceList = []
while (pageStart >= 0) {
const deviceRes = await app.fs.yingshiRequest.post('lapp/device/list', {
query: {
accessToken: tokenYingshi,
pageStart,
pageSize: 50
}
})
if (deviceRes.code == 200) {
if (deviceRes.data.length) {
deviceList = deviceList.concat.apply(deviceList, deviceRes.data)
pageStart++
} else {
pageStart = -1
}
}
}
console.log(deviceList);
}
// const await models.UserToken.destroy({
// where: {
@ -47,6 +48,6 @@ module.exports = function (app, opts) {
});
return {
// freshYingshiState
freshYingshiState
}
}
Loading…
Cancel
Save