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 46aa73a..3ccc838 100644 --- a/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js @@ -12,7 +12,7 @@ async function getCameraProject (ctx, next) { let findOption = { attributes: { exclude: ['delete', 'recycleTime',] }, where: { - // createUserId: userId, + createUserId: userId, recycleTime: null, delete: false }, @@ -262,11 +262,13 @@ async function detail (ctx) { async function getCameraListAll (ctx) { try { const { models } = ctx.fs.dc; - var front = new moment(); //验证前时间 + const { userId, token } = ctx.fs.api + const cameraRes = await models.Camera.findAll({ attributes: { exclude: ['delete', 'recycleTime', 'rtmp', 'createUserId', 'nvrId', 'kindId', 'yingshiSecretId', 'gbId'] }, order: [['id', 'DESC']], where: { + createUserId: userId, delete: false, recycleTime: null, }, @@ -286,9 +288,7 @@ async function getCameraListAll (ctx) { ], }] }) - var after = new moment(); - var duration = moment.duration(after.diff(front))._data.milliseconds; - console.log('duration',duration) + ctx.status = 200; ctx.body = cameraRes } catch (error) { diff --git a/code/VideoAccess-VCMP/script/1.3.2/schema/1.collect_all_camera_to_one_user.sql b/code/VideoAccess-VCMP/script/1.3.2/schema/1.collect_all_camera_to_one_user.sql new file mode 100644 index 0000000..5791819 --- /dev/null +++ b/code/VideoAccess-VCMP/script/1.3.2/schema/1.collect_all_camera_to_one_user.sql @@ -0,0 +1,5 @@ +-- 将所有现有摄像头归为同一账号下 + +UPDATE camera +SET create_user_id = 2149 +WHERE create_time <= make_timestamptz(2022, 9, 17, 22, 22, 22); \ No newline at end of file