|
|
@ -301,6 +301,40 @@ async function getCameraListAll (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function getCmaeraUniqueConfig (ctx) { |
|
|
|
// 为 李玉 python 摄像头状态查询的摄像头列表查询
|
|
|
|
// 获取所有已配置的序列号+通道号唯一的摄像头
|
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
const sequelize = ctx.fs.dc.orm; |
|
|
|
// TODO: 目前只获取 yingshi 的
|
|
|
|
|
|
|
|
const cameraRes = await sequelize.query(` |
|
|
|
SELECT DISTINCT("serial_no", "channel_no"), |
|
|
|
camera.id, |
|
|
|
"camera"."serial_no" AS "serialNo", |
|
|
|
"camera"."type" AS "type", |
|
|
|
"camera"."channel_no" AS "channelNo", |
|
|
|
"secretYingshi"."token" AS "yingshiToken" |
|
|
|
FROM "camera" AS "camera" |
|
|
|
LEFT OUTER JOIN "secret_yingshi" AS "secretYingshi" |
|
|
|
ON "camera"."yingshi_secret_id" = "secretYingshi"."id" |
|
|
|
WHERE "camera"."delete" = false |
|
|
|
AND "camera"."type" = 'yingshi' |
|
|
|
AND "camera"."recycle_time" IS NULL; |
|
|
|
`)
|
|
|
|
|
|
|
|
ctx.status = 200; |
|
|
|
ctx.body = cameraRes[0] |
|
|
|
} catch (error) { |
|
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: error`); |
|
|
|
ctx.status = 400; |
|
|
|
ctx.body = { |
|
|
|
message: typeof error == 'string' ? error : undefined |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function banned (ctx) { |
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
@ -587,6 +621,7 @@ module.exports = { |
|
|
|
getCameraProject, |
|
|
|
getCamera, |
|
|
|
getCameraListAll, |
|
|
|
getCmaeraUniqueConfig, |
|
|
|
detail, |
|
|
|
banned, |
|
|
|
del, |
|
|
|