diff --git a/code/VideoAccess-VCMP/api/.vscode/launch.json b/code/VideoAccess-VCMP/api/.vscode/launch.json index 9568af8..5b54c7b 100644 --- a/code/VideoAccess-VCMP/api/.vscode/launch.json +++ b/code/VideoAccess-VCMP/api/.vscode/launch.json @@ -20,6 +20,7 @@ "--redisPort 6379", "--axyApiUrl http://127.0.0.1:4100", "--iotAuthApi http://127.0.0.1:4200", + "--iotVideoServerUrl http://221.230.55.27:8081", "--godUrl https://restapi.amap.com/v3", "--godKey 21c2d970e1646bb9a795900dd00093ce" ] 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 3af5b2e..cc74a2e 100644 --- a/code/VideoAccess-VCMP/api/app/lib/controllers/camera/create.js +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/camera/create.js @@ -161,6 +161,7 @@ async function createNvrCamera (ctx) { }) } else { createData.push({ + type: 'nvr', serialNo: c.streamid, name: c.name, sip: corCamera.sipip, diff --git a/code/VideoAccess-VCMP/api/app/lib/controllers/nvr/index.js b/code/VideoAccess-VCMP/api/app/lib/controllers/nvr/index.js index 01d58a6..e96d72d 100644 --- a/code/VideoAccess-VCMP/api/app/lib/controllers/nvr/index.js +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/nvr/index.js @@ -243,7 +243,20 @@ async function detail (ctx) { } const corUser = await ctx.app.fs.authRequest.get(`user/${nvrRes.createUserId}/message`, { query: { token } }) - + const serverDRes = (await ctx.app.fs.videoServerRequest.post(`gateway/plugins`) || '') + const serverDArr = JSON.parse(serverDRes.replace(/'/g, '"')) || [] + const serverDConfig = serverDArr.find(s => s.Name == 'GB28181') + let serveD = {} + if (serverDConfig) { + const { Config } = serverDConfig + let ConfigArr = Config.split('\n') + for (let c of ConfigArr) { + let config = c.split(' = ') + if (config.length == 2) { + serveD[config[0].trim()] = config[1].trim().replace(/\"/g, '') + } + } + } let nvrDetail = { ...nvrRes.dataValues, station: bindStations, @@ -251,7 +264,8 @@ async function detail (ctx) { createUser: { namePresent: corUser[0].namePresent }, - accessWay: 'GB/T28181' + accessWay: 'GB/T28181', + accessInfo: serveD } ctx.status = 200; diff --git a/code/VideoAccess-VCMP/api/app/lib/service/paasRequest.js b/code/VideoAccess-VCMP/api/app/lib/service/paasRequest.js index 5ab6678..1cfa081 100644 --- a/code/VideoAccess-VCMP/api/app/lib/service/paasRequest.js +++ b/code/VideoAccess-VCMP/api/app/lib/service/paasRequest.js @@ -2,9 +2,10 @@ const request = require('superagent') class paasRequest { - constructor(root, { query = {} } = {}) { + constructor(root, { query = {} } = {}, option) { this.root = root; this.query = query + this.option = option } #buildUrl = (url) => { @@ -16,7 +17,7 @@ class paasRequest { if (err) { reject(err); } else { - resolve(res.body); + resolve(res[this.option.dataWord]); } }; } @@ -51,7 +52,7 @@ function factory (app, opts) { try { for (let r of opts.pssaRequest) { if (r.name && r.root) { - app.fs[r.name] = new paasRequest(r.root, { ...(r.params || {}) }) + app.fs[r.name] = new paasRequest(r.root, { ...(r.params || {}) }, { dataWord: r.dataWord || 'body' }) } else { throw 'opts.pssaRequest 参数错误!' } diff --git a/code/VideoAccess-VCMP/api/config.js b/code/VideoAccess-VCMP/api/config.js index dd70cf4..4b88f2b 100644 --- a/code/VideoAccess-VCMP/api/config.js +++ b/code/VideoAccess-VCMP/api/config.js @@ -14,8 +14,9 @@ args.option(['f', 'fileHost'], '文件中心本地化存储: WebApi 服务器地 args.option('redisHost', 'redisHost'); args.option('redisPort', 'redisPort'); args.option('redisPswd', 'redisPassword'); -args.option('iotAuthApi', 'IOT 鉴权 api'); args.option('axyApiUrl', '安心云 api'); +args.option('iotAuthApi', 'IOT 鉴权 api'); +args.option('iotVideoServerUrl', '视频后端服务地址'); args.option('godUrl', '高德地图API请求地址'); args.option('godKey', '高德地图API key'); @@ -29,6 +30,7 @@ const IOTA_REDIS_SERVER_PORT = process.env.IOTA_REDIS_SERVER_PORT || flags.redis const IOTA_REDIS_SERVER_PWD = process.env.IOTA_REDIS_SERVER_PWD || flags.redisPswd || "";//redis 密码 const IOT_AUTH_API = process.env.IOT_AUTH_API || flags.iotAuthApi; +const IOT_VIDEO_SERVER_URL = process.env.IOT_VIDEO_SERVER_URL || flags.iotVideoServerUrl const AXY_API_URL = process.env.AXY_API_URL || flags.axyApiUrl; const GOD_URL = process.env.GOD_URL || flags.godUrl || 'https://restapi.amap.com/v3'; const GOD_KEY = process.env.GOD_KEY || flags.godKey; @@ -85,6 +87,10 @@ const product = { key: GOD_KEY } } + }, { + name: 'videoServerRequest', + root: IOT_VIDEO_SERVER_URL + '/api', + dataWord: 'text' },] } } diff --git a/code/VideoAccess-VCMP/web/client/src/layout/components/header/index.jsx b/code/VideoAccess-VCMP/web/client/src/layout/components/header/index.jsx index 684980d..5d8ee4d 100644 --- a/code/VideoAccess-VCMP/web/client/src/layout/components/header/index.jsx +++ b/code/VideoAccess-VCMP/web/client/src/layout/components/header/index.jsx @@ -4,82 +4,84 @@ import { connect } from "react-redux"; import { Nav, Avatar, Dropdown } from "@douyinfe/semi-ui"; const Header = (props) => { - const { dispatch, history, user, actions, socket } = props; + const { dispatch, history, user, actions, socket } = props; - return ( - <> -