Browse Source

删除设备 删除推送配置相关

release_1.1.2
巴林闲侠 2 years ago
parent
commit
ed0e95ad5b
  1. 7
      code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js
  2. 29
      code/VideoAccess-VCMP/api/app/lib/controllers/status/push.js

7
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

29
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,

Loading…
Cancel
Save