From 0a6969f1f2376eca907b2af84a44f9dcb39f40e4 Mon Sep 17 00:00:00 2001 From: deartibers <947466799@qq.com> Date: Mon, 8 Aug 2022 10:48:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sections/offline/containers/carrierpigeon.jsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx b/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx index 2256ce0..5f26d57 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx +++ b/code/VideoAccess-VCMP/web/client/src/sections/offline/containers/carrierpigeon.jsx @@ -41,8 +41,8 @@ const Carrierpigeon = (props) => { list: [ { name: "策略类型", value: "pushWay" }, { name: "推送机制", value: "noticeWay" }, - { name: "监听设备数量", value: "logCount" }, - { name: "累计推送次数", value: "monitorCount" }, + { name: "监听设备数量", value: "monitorCount" }, + { name: "累计推送次数", value: "logCount" }, ] }, ]; @@ -238,22 +238,21 @@ const Carrierpigeon = (props) => { }, }, { - title: "监听设备数量", + title: "累计推送次数", dataIndex: "logCount", key: "logCount", render: (_, r, index) => { - return r.logCount + return (r.logCount + '次') }, }, { - title: "累计推送次数", + title: "监听设备数量", dataIndex: "monitorCount", key: "monitorCount", render: (_, r, index) => { - return (r.monitorCount + '次') + return r.monitorCount }, }, - { title: "策略类型", dataIndex: "pushWay", From ed0e95ad5bf94cd1efdeed6e82f7005851bdc657 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Mon, 8 Aug 2022 10:54:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=AE=BE=E5=A4=87=20?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=8E=A8=E9=80=81=E9=85=8D=E7=BD=AE=E7=9B=B8?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/app/lib/controllers/camera/index.js | 7 +++-- .../api/app/lib/controllers/status/push.js | 29 +++++-------------- 2 files changed, 13 insertions(+), 23 deletions(-) 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 c465c20..5c47d3b 100644 --- a/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js @@ -310,20 +310,23 @@ async function del (ctx) { const { cameraId } = ctx.params const { token } = ctx.fs.api + await models.CameraStatusPushMonitor.destroy({ + where: { + cameraId: cameraId + } + }) await models.CameraAbilityBind.destroy({ where: { cameraId: cameraId }, transaction }) - await models.CameraRemark.destroy({ where: { cameraId: cameraId }, transaction }) - await models.Camera.destroy({ where: { id: cameraId diff --git a/code/VideoAccess-VCMP/api/app/lib/controllers/status/push.js b/code/VideoAccess-VCMP/api/app/lib/controllers/status/push.js index d508f1d..c3625b2 100644 --- a/code/VideoAccess-VCMP/api/app/lib/controllers/status/push.js +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/status/push.js @@ -125,7 +125,6 @@ async function get (ctx) { const { userId, token } = ctx.fs.api const { limit, page, orderBy, orderDirection, name, pushWay } = ctx.query - const sequelize = ctx.fs.dc.ORM; let findOption = { where: {}, order: [ @@ -155,21 +154,6 @@ async function get (ctx) { delete findOption.offset const configIds = configLimitRes.map(c => c.id) findOption.where.id = { $in: configIds } - findOption.attributes = { - include: [ - [sequelize.fn('COUNT', sequelize.col('cameraStatusPushMonitors.id')), 'monitorCount'], - [sequelize.fn('COUNT', sequelize.col('cameraStatusPushLogs.id')), 'logCount'] - ], - } - findOption.distinct = true - findOption.subQuery = false - findOption.group = [ - 'cameraStatusPushConfig.id', - 'cameraStatusPushMonitors.id', - 'cameraStatusPushLogs.id', - 'cameraStatusPushReceivers.id', - 'cameraStatusPushMonitors->camera.id', - ] findOption.order = [ [orderBy || 'id', orderDirection || 'DESC'] ] @@ -186,7 +170,7 @@ async function get (ctx) { }, { model: models.CameraStatusPushLog, - attributes: [], + attributes: ['id'], duplicating: false, required: false, }, @@ -200,14 +184,17 @@ async function get (ctx) { const configRes = await models.CameraStatusPushConfig.findAll(findOption) - delete findOption.attributes - delete findOption.group delete findOption.order - delete findOption.distinct - delete findOption.subQuery delete findOption.include delete findOption.where.id const count = await models.CameraStatusPushConfig.count(findOption) + + for (let { dataValues: c } of configRes) { + c.monitorCount = c.cameraStatusPushMonitors.length; + c.logCount = c.cameraStatusPushLogs.length; + delete c.cameraStatusPushLogs + } + ctx.status = 200; ctx.body = { count: count,