Browse Source

Merge branch 'dev_trial' of https://gitea.anxinyun.cn/free-sun/FS-IOT into dev_trial

release_1.3.0
wenlele 3 years ago
parent
commit
dc4572ae23
  1. 10
      code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js
  2. 5
      code/VideoAccess-VCMP/script/1.3.2/schema/1.collect_all_camera_to_one_user.sql
  3. 3
      code/VideoAccess-VCMP/web/client/src/sections/monitor/containers/index.js
  4. 52
      code/VideoAccess-VCMP/web/client/src/sections/monitor/containers/videoPlayStatus.js
  5. 10
      code/VideoAccess-VCMP/web/client/src/sections/monitor/routes.js

10
code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js

@ -12,7 +12,7 @@ async function getCameraProject (ctx, next) {
let findOption = { let findOption = {
attributes: { exclude: ['delete', 'recycleTime',] }, attributes: { exclude: ['delete', 'recycleTime',] },
where: { where: {
// createUserId: userId, createUserId: userId,
recycleTime: null, recycleTime: null,
delete: false delete: false
}, },
@ -262,11 +262,13 @@ async function detail (ctx) {
async function getCameraListAll (ctx) { async function getCameraListAll (ctx) {
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
var front = new moment(); //验证前时间 const { userId, token } = ctx.fs.api
const cameraRes = await models.Camera.findAll({ const cameraRes = await models.Camera.findAll({
attributes: { exclude: ['delete', 'recycleTime', 'rtmp', 'createUserId', 'nvrId', 'kindId', 'yingshiSecretId', 'gbId'] }, attributes: { exclude: ['delete', 'recycleTime', 'rtmp', 'createUserId', 'nvrId', 'kindId', 'yingshiSecretId', 'gbId'] },
order: [['id', 'DESC']], order: [['id', 'DESC']],
where: { where: {
createUserId: userId,
delete: false, delete: false,
recycleTime: null, 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.status = 200;
ctx.body = cameraRes ctx.body = cameraRes
} catch (error) { } catch (error) {

5
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);

3
code/VideoAccess-VCMP/web/client/src/sections/monitor/containers/index.js

@ -2,5 +2,6 @@
import MonitorCenter from './monitorCenter'; import MonitorCenter from './monitorCenter';
import VideoPlayCross from './videoPlayCross'; import VideoPlayCross from './videoPlayCross';
import VideoPlayStatus from './videoPlayStatus';
export { MonitorCenter, VideoPlayCross }; export { MonitorCenter, VideoPlayCross, VideoPlayStatus };

52
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 (
<div style={{ height: '100vh', width: '100vw' }}>
<div style={{ textAlign: 'center', marginTop: '4%' }}>
<div id={'video_play_check_dom'} style={{ display: 'inline-block', height: 300, width: 400, }}></div>
</div>
<div id='video_play_check_result' >
<div style={{ width: 400, margin: 'auto' }}>
<p style={{ opacity: .4 }}>status_code = 0 则播放成功</p>
<p>status_code<span id='status_code' style={{ float: 'right' }}>{playState.retcode}</span></p>
<p>status_message <span id='status_message' style={{ float: 'right' }}>{playState.msg}</span></p>
<p>status_type<span id='status_type' style={{ float: 'right' }}>{playState.type}</span></p>
</div>
</div>
</div>
)
}
export default VideoPlayStatus

10
code/VideoAccess-VCMP/web/client/src/sections/monitor/routes.js

@ -1,5 +1,5 @@
'use strict'; 'use strict';
import { MonitorCenter, VideoPlayCross } from './containers'; import { MonitorCenter, VideoPlayCross, VideoPlayStatus } from './containers';
export default [{ export default [{
type: 'inner', type: 'inner',
@ -17,4 +17,12 @@ export default [{
breadcrumb: '', breadcrumb: '',
component: VideoPlayCross, component: VideoPlayCross,
} }
}, {
type: 'outer',
route: {
path: '/video_play_status',
key: 'videoPlayStatus',
breadcrumb: '',
component: VideoPlayStatus,
}
}]; }];
Loading…
Cancel
Save