From d290ea69bee50b43ab686a2610574383c9fa0415 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Thu, 8 Sep 2022 20:31:37 +0800 Subject: [PATCH 1/2] video play check --- .../src/sections/monitor/containers/index.js | 3 +- .../monitor/containers/videoPlayStatus.js | 52 +++++++++++++++++++ .../web/client/src/sections/monitor/routes.js | 10 +++- 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 code/VideoAccess-VCMP/web/client/src/sections/monitor/containers/videoPlayStatus.js diff --git a/code/VideoAccess-VCMP/web/client/src/sections/monitor/containers/index.js b/code/VideoAccess-VCMP/web/client/src/sections/monitor/containers/index.js index de8fc32..92b0a50 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/monitor/containers/index.js +++ b/code/VideoAccess-VCMP/web/client/src/sections/monitor/containers/index.js @@ -2,5 +2,6 @@ import MonitorCenter from './monitorCenter'; import VideoPlayCross from './videoPlayCross'; +import VideoPlayStatus from './videoPlayStatus'; -export { MonitorCenter, VideoPlayCross }; \ No newline at end of file +export { MonitorCenter, VideoPlayCross, VideoPlayStatus }; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/web/client/src/sections/monitor/containers/videoPlayStatus.js b/code/VideoAccess-VCMP/web/client/src/sections/monitor/containers/videoPlayStatus.js new file mode 100644 index 0000000..a2d82fa --- /dev/null +++ b/code/VideoAccess-VCMP/web/client/src/sections/monitor/containers/videoPlayStatus.js @@ -0,0 +1,52 @@ +import React, { useEffect, useState } from 'react'; +import EZUIKit from 'ezuikit-js' +import qs from "qs"; + +const VideoPlayStatus = (props) => { + const [playState, setPlayState] = useState({}) + + useEffect(() => { + const params = qs.parse(props.location.search.slice(1)) + /** + * query 查询参数 + * + * ysToken 萤石token + * serialNo 序列号 + * channelNo 通道号 默认 1 + */ + const player = new EZUIKit.EZUIKitPlayer({ + id: 'video_play_check_dom', // 视频容器ID + accessToken: params?.ysToken, + url: `ezopen://open.ys7.com/${params.serialNo}/${params.channelNo || '1'}.live`, + width: 400, + height: 300, + handleSuccess: (e) => { + console.log(e); + setPlayState(e) + }, + handleError: (e) => { + console.log(e); + console.log(e.retcode); + setPlayState(e) + }, + }) + }, []) + + return ( +
+
+
+
+
+
+

status_code = 0 则播放成功

+

status_code:{playState.retcode}

+

status_message: {playState.msg}

+

status_type:{playState.type}

+
+
+
+ ) +} + +export default VideoPlayStatus \ No newline at end of file diff --git a/code/VideoAccess-VCMP/web/client/src/sections/monitor/routes.js b/code/VideoAccess-VCMP/web/client/src/sections/monitor/routes.js index 0009f51..df02d48 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/monitor/routes.js +++ b/code/VideoAccess-VCMP/web/client/src/sections/monitor/routes.js @@ -1,5 +1,5 @@ 'use strict'; -import { MonitorCenter, VideoPlayCross } from './containers'; +import { MonitorCenter, VideoPlayCross, VideoPlayStatus } from './containers'; export default [{ type: 'inner', @@ -17,4 +17,12 @@ export default [{ breadcrumb: '', component: VideoPlayCross, } +}, { + type: 'outer', + route: { + path: '/video_play_status', + key: 'videoPlayStatus', + breadcrumb: '', + component: VideoPlayStatus, + } }]; \ No newline at end of file From 04c06b07dd898faed8d7bdcadb7aa9df3c188839 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Tue, 13 Sep 2022 14:44:53 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A7=86=E9=A2=91=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=9D=83=E9=99=90=E7=94=A8=E8=B4=A6=E5=8F=B7=E5=8C=BA=E5=88=86?= =?UTF-8?q?=EF=BC=8C=E7=94=A8=E6=88=B7=E5=8F=AA=E8=83=BD=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E8=87=AA=E5=B7=B1=E6=8E=A5=E5=85=A5=E7=9A=84=E8=A7=86=E9=A2=91?= =?UTF-8?q?=EF=BC=8C=E4=B8=BA=E5=90=8E=E7=BB=AD=E8=AE=BE=E5=A4=87=E5=85=B1?= =?UTF-8?q?=E4=BA=AB=E6=9D=83=E9=99=90=E7=AE=A1=E7=90=86=E9=A2=84=E7=95=99?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/app/lib/controllers/camera/index.js | 10 +++++----- .../1.3.2/schema/1.collect_all_camera_to_one_user.sql | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 code/VideoAccess-VCMP/script/1.3.2/schema/1.collect_all_camera_to_one_user.sql 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