From 6c7bdcc78cbb2a863067d2b880c54c7766c27cc8 Mon Sep 17 00:00:00 2001 From: wenlele Date: Wed, 19 Jul 2023 19:34:17 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=B8=85=E6=99=B0=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/app/lib/controllers/camera/create.js | 4 +- .../api/app/lib/models/camera.js | 9 + .../api/app/lib/schedule/freshYingshiMsg.js | 4 +- .../script/1.3.8/achema/1.update_camera.sql | 4 + .../components/videoPlayer/videoOperation.jsx | 2 +- .../src/components/videoPlayer/videoPlay.jsx | 23 +- .../components/fluoriteCamera.jsx | 1049 +++++++++-------- .../equipmentWarehouse/containers/camera.jsx | 1 + 8 files changed, 600 insertions(+), 496 deletions(-) create mode 100644 code/VideoAccess-VCMP/script/1.3.8/achema/1.update_camera.sql diff --git a/code/VideoAccess-VCMP/api/app/lib/controllers/camera/create.js b/code/VideoAccess-VCMP/api/app/lib/controllers/camera/create.js index 26baf5d..81fd62f 100644 --- a/code/VideoAccess-VCMP/api/app/lib/controllers/camera/create.js +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/camera/create.js @@ -31,7 +31,7 @@ async function createYingshi (ctx) { const { id, name, cloudControl, highDefinition, memoryCard, voice, kindId, abilityId, rtmp, serialNo, longitude, latitude, - channelNo, + channelNo,definition } = ctx.request.body; let handleCameraId = id errMsg = (handleCameraId ? '修改' : '添加') + errMsg @@ -49,7 +49,7 @@ async function createYingshi (ctx) { serialNo: String(serialNo).toUpperCase(), yingshiSecretId: beloneSecret.id, gbId: corGbYingshiRes ? corGbYingshiRes.id : null, - channelNo, + channelNo,definition } if (handleCameraId) { diff --git a/code/VideoAccess-VCMP/api/app/lib/models/camera.js b/code/VideoAccess-VCMP/api/app/lib/models/camera.js index 8ca299d..cbae79f 100644 --- a/code/VideoAccess-VCMP/api/app/lib/models/camera.js +++ b/code/VideoAccess-VCMP/api/app/lib/models/camera.js @@ -87,6 +87,15 @@ module.exports = dc => { field: "cloud_control", autoIncrement: false }, + definition: { + type: DataTypes.BOOLEAN, + allowNull: true, + defaultValue: null, + comment: "清晰度", + primaryKey: false, + field: "definition", + autoIncrement: false + }, highDefinition: { type: DataTypes.BOOLEAN, allowNull: true, diff --git a/code/VideoAccess-VCMP/api/app/lib/schedule/freshYingshiMsg.js b/code/VideoAccess-VCMP/api/app/lib/schedule/freshYingshiMsg.js index 0e4726e..e36c94b 100644 --- a/code/VideoAccess-VCMP/api/app/lib/schedule/freshYingshiMsg.js +++ b/code/VideoAccess-VCMP/api/app/lib/schedule/freshYingshiMsg.js @@ -6,8 +6,8 @@ module.exports = function (app, opts) { { interval: '50 */4 * * * *', // interval: '*/3 * * * *', - // immediate: true, - proRun: true, + immediate: true, + // proRun: true, }, async () => { console.log('萤石状态查询 ', moment().format('YYYY-MM-DD HH:mm:ss')); diff --git a/code/VideoAccess-VCMP/script/1.3.8/achema/1.update_camera.sql b/code/VideoAccess-VCMP/script/1.3.8/achema/1.update_camera.sql new file mode 100644 index 0000000..a669915 --- /dev/null +++ b/code/VideoAccess-VCMP/script/1.3.8/achema/1.update_camera.sql @@ -0,0 +1,4 @@ +alter table camera + add definition boolean; + +comment on column camera.definition is '清晰度'; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoOperation.jsx b/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoOperation.jsx index ca30cd7..926e591 100644 --- a/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoOperation.jsx +++ b/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoOperation.jsx @@ -52,7 +52,7 @@ const VideoOperation = ({ // yingshiPrepareRef.current = 'yingshi' // setYingshiPrepare('play') } - +console.log(1111); videoFront = new moment(); //验证前时间 player.stop().then((res) => { if (resolution == 'sd') { diff --git a/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlay.jsx b/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlay.jsx index 9d70c76..5402ca7 100644 --- a/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlay.jsx +++ b/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlay.jsx @@ -77,6 +77,9 @@ const VideoPlay = ({ dispatch, actions, playUrlHd: `ezopen://open.ys7.com/${videoObj.serialNo}/${videoObj.channelNo || '1'}.hd.live`, replayUrl: `ezopen://open.ys7.com/${videoObj.serialNo}/${videoObj.channelNo || '1'}.hd.local.rec`, } + if (videoObj.definition) { + videoObj.playUrlSd = `ezopen://open.ys7.com/${videoObj.serialNo}/${videoObj.channelNo || '1'}.hd.live` + } } else { videoObj = { ...videoObj, @@ -476,16 +479,16 @@ const VideoPlay = ({ dispatch, actions, }, handleError: (e) => { //播放失败 console.log(e, '播放失败'); - if (playNumber.current > 4) { - setNumbers(e.retcode) - videoAfter = new moment(); //验证后时间 - setDisappear(true) - } else { - playNumber.current = playNumber.current + 1 - yingshiPlayer.current.stop().then(() => { - yingshiPlayer.current.play({ url: videoObj.playUrlSd }) - }) - } + // if (playNumber.current > 4) { + // setNumbers(e.retcode) + videoAfter = new moment(); //验证后时间 + // setDisappear(true) + // } else { + // playNumber.current = playNumber.current + 1 + // yingshiPlayer.current.stop().then(() => { + // yingshiPlayer.current.play({ url: videoObj.playUrlSd }) + // }) + // } }, }) setPlayer(player) diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/fluoriteCamera.jsx b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/fluoriteCamera.jsx index ae18dd4..3ab9d02 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/fluoriteCamera.jsx +++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/fluoriteCamera.jsx @@ -3,471 +3,558 @@ import { connect } from "react-redux"; import { Form, Row, Col, Spin } from "@douyinfe/semi-ui"; import "./cameraModal.less"; function fluoriteCamera ({ cRef, CameraKind, CameraAbility, cameraData, ashTrue, ashFalse }) { - const { TextArea } = Form; - const form = useRef(); - const [cloud, setcloud] = useState(""); //云台支持 - const [voice, setvoice] = useState(""); //语音支持 - const [switching, setSwitching] = useState(""); //高清切换 - const [memoryList, setMemoryList] = useState([ - { - id: 1, - value: "8g", - }, - { - id: 2, - value: "16g", - }, - { - id: 3, - value: "32g", - }, - { - id: 4, - value: "64g", - }, - { - id: 5, - value: "128g", - }, - { - id: 6, - value: "256g", - }, - { - id: 7, - value: ">256g", - }, - ]); //内存卡列表 + const { TextArea } = Form; + const form = useRef(); + const [cloud, setcloud] = useState(""); //云台支持 + const [voice, setvoice] = useState(""); //语音支持 + const [definition, setDefinition] = useState(""); //高清标清 + const [switching, setSwitching] = useState(""); //高清切换 + const [memoryList, setMemoryList] = useState([ + { + id: 1, + value: "8g", + }, + { + id: 2, + value: "16g", + }, + { + id: 3, + value: "32g", + }, + { + id: 4, + value: "64g", + }, + { + id: 5, + value: "128g", + }, + { + id: 6, + value: "256g", + }, + { + id: 7, + value: ">256g", + }, + ]); //内存卡列表 - useEffect(() => { - setcloud(cameraData.cloudControl || ""); - setvoice(cameraData.voice || ""); - setSwitching(cameraData.highDefinition || ""); - }, []); - function handleLocation () { - //高德经纬度 - window.open("https://lbs.amap.com/tools/picker", "_blank"); - } - function positionForm (val) { - //安装位置校验 - let zz = /^(-?\d+)(\.\d+)?$/; - if (!val) { - return "请输入或拾取高德经纬度坐标"; - } else if (val.split(",").length != 2) { - return "请输入格式为116.354169,39.835452的经纬度坐标"; - } else if (!zz.test(val.split(",")[0])) { - return "只能填写数字"; - } else if (!zz.test(val.split(",")[1])) { - return "只能填写数字"; - } else { - return ""; - } - } - useImperativeHandle(cRef, () => ({ - //传给父组件方法 - //子组件暴露给父组件的方法 - fluoriteCameraForm: form.current.validate, - resetFluoriteCamera: form.current.reset, - toempty: empty, - })); - function empty () { - setcloud(""); - setvoice(""); - setSwitching(""); - } - return ( - <> -
{ - // let setting = ["abilityId", "cloudControl", "highDefinition", "kindId", "name", "position", "rtmp", "serialNo",] - let setting = ["abilityId", "cloudControl", "highDefinition", "kindId", "name", "position", "serialNo","channelNo"] - let b = {} - setting.map((item) => { - if (values.hasOwnProperty(item)) { - return b.true = values.hasOwnProperty(item) + useEffect(() => { + setcloud(cameraData.cloudControl || ""); + setvoice(cameraData.voice || ""); + setSwitching(cameraData.highDefinition || ""); + }, []); + function handleLocation () { + //高德经纬度 + window.open("https://lbs.amap.com/tools/picker", "_blank"); + } + function positionForm (val) { + //安装位置校验 + let zz = /^(-?\d+)(\.\d+)?$/; + if (!val) { + return "请输入或拾取高德经纬度坐标"; + } else if (val.split(",").length != 2) { + return "请输入格式为116.354169,39.835452的经纬度坐标"; + } else if (!zz.test(val.split(",")[0])) { + return "只能填写数字"; + } else if (!zz.test(val.split(",")[1])) { + return "只能填写数字"; + } else { + return ""; + } + } + useImperativeHandle(cRef, () => ({ + //传给父组件方法 + //子组件暴露给父组件的方法 + fluoriteCameraForm: form.current.validate, + resetFluoriteCamera: form.current.reset, + toempty: empty, + })); + function empty () { + setcloud(""); + setvoice(""); + setSwitching(""); + } + return ( + <> + { + // let setting = ["abilityId", "cloudControl", "highDefinition", "kindId", "name", "position", "rtmp", "serialNo",] + let setting = ["abilityId", "cloudControl", "highDefinition", "kindId", "name", "position", "serialNo", "channelNo"] + let b = {} + setting.map((item) => { + if (values.hasOwnProperty(item)) { + return b.true = values.hasOwnProperty(item) + } else { + return b.false = values.hasOwnProperty(item) + } + }) + Object.keys(b).length == 1 ? ashTrue() : ashFalse() + }} + initValues={{ + name: cameraData.name || "", + highDefinition: cameraData?.highDefinition, + memoryCard: cameraData.memoryCard || "", + position: cameraData.longitude + ? `${cameraData.longitude},${cameraData.latitude}` + : "", + kindId: cameraData.kindId || "", + abilityId: cameraData.cameraAbilities + ? cameraData.cameraAbilities.map((item) => item.id) + : "" + , + cloudControl: cameraData.cloudControl, + voice: cameraData.voice, + serialNo: cameraData.serialNo || "", + channelNo: cameraData.channelNo || "", + // rtmp: cameraData.rtmp || "", + rtmp: '此处无效 自动生成', + }} + getFormApi={(formApi) => (form.current = formApi)} + > + + + {/* 设备名称 */} + + {/* 高清切换 */} + { + if (checked.target.value == true) { + setSwitching(true); } else { - return b.false = values.hasOwnProperty(item) + setSwitching(false); } - }) - Object.keys(b).length == 1 ? ashTrue() : ashFalse() - }} - initValues={{ - name: cameraData.name || "", - highDefinition: cameraData?.highDefinition, - memoryCard: cameraData.memoryCard || "", - position: cameraData.longitude - ? `${cameraData.longitude},${cameraData.latitude}` - : "", - kindId: cameraData.kindId || "", - abilityId: cameraData.cameraAbilities - ? cameraData.cameraAbilities.map((item) => item.id) - : "" - , - cloudControl: cameraData.cloudControl, - voice: cameraData.voice, - serialNo: cameraData.serialNo || "", - channelNo: cameraData.channelNo || "", - // rtmp: cameraData.rtmp || "", - rtmp: '此处无效 自动生成', - }} - getFormApi={(formApi) => (form.current = formApi)} - > - - - {/* 设备名称 */} - - {/* 高清切换 */} - { - if (checked.target.value == true) { - setSwitching(true); - } else { - setSwitching(false); - } - }} + }} + > + +
- -
- 支持 -
- {switching == true ? ( -
- 1 -
- ) : ( - "" - )} -
- -
- 不支持 -
- {switching == false && switching !== "" ? ( -
- 1 -
- ) : ( - "" - )} -
- - {/* 内存 */} - + {switching == true ? ( +
+ 1 +
+ ) : ( + "" + )} + + +
- {memoryList.map((item, index) => ( - - {item.value} - - ))} - - {/* 安装位置 */} -
- -
- -
+ 不支持
- {/* 设备类型 */} + {switching == false && switching !== "" ? ( +
+ 1 +
+ ) : ( + "" + )} + + + {/* 内存 */} + + {memoryList.map((item, index) => ( + + {item.value} + + ))} + + {/* 安装位置 */} +
+ +
+ +
+
+ {/* 设备类型 */} - + {CameraKind.map((item, index) => ( + + {item.kind} + + ))} + + {/* 语音支持 */} + { + if (checked.target.value == true) { + setDefinition(true); + } else { + setDefinition(false); + } + }} + > + +
- {CameraKind.map((item, index) => ( - - {item.kind} - - ))} - + 高清 +
+ {definition == true ? ( +
+ 1 +
+ ) : ( + "" + )} +
+ +
+ 标清 +
+ {definition == false && definition !== "" ? ( +
+ 1 +
+ ) : ( + "" + )} +
+
- - - {/* 云台支持 */} - { - if (checked.target.value == true) { - setcloud(true); - } else { - setcloud(false); - } - }} + + + {/* 云台支持 */} + { + if (checked.target.value == true) { + setcloud(true); + } else { + setcloud(false); + } + }} + > + +
+ 支持 +
+ {cloud == true ? ( +
+ 1 +
+ ) : ( + "" + )} +
+ +
- -
- 支持 -
- {cloud == true ? ( -
- 1 -
- ) : ( - "" - )} -
- -
- 不支持 -
- {cloud == false && cloud !== "" ? ( -
- 1 -
- ) : ( - "" - )} -
- - {/* 语音支持 */} - { - if (checked.target.value == true) { - setvoice(true); - } else { - setvoice(false); - } - }} + 不支持 +
+ {cloud == false && cloud !== "" ? ( +
+ 1 +
+ ) : ( + "" + )} +
+
+ {/* 语音支持 */} + { + if (checked.target.value == true) { + setvoice(true); + } else { + setvoice(false); + } + }} + > + +
- -
- 支持 -
- {voice == true ? ( -
- 1 -
- ) : ( - "" - )} -
- -
- 不支持 -
- {voice == false && voice !== "" ? ( -
- 1 -
- ) : ( - "" - )} -
- - {/* 设备名称 */} - - {/* 通道号 */} - - {/* RTMP地址接入 */} - {/*