diff --git a/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js b/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js index e4e8667..e814eec 100644 --- a/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js +++ b/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 diff --git a/code/VideoAccess-VCMP/api/app/lib/schedule/freshYingshiState.js b/code/VideoAccess-VCMP/api/app/lib/schedule/freshYingshiState.js index 5b5a279..75abccd 100644 --- a/code/VideoAccess-VCMP/api/app/lib/schedule/freshYingshiState.js +++ b/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 } } \ No newline at end of file