From f638047ae7d63e979000ddf607ea8fc0f3263d38 Mon Sep 17 00:00:00 2001 From: yuan_yi <1650192445@qq.com> Date: Tue, 24 May 2022 13:51:26 +0800 Subject: [PATCH] webpack --- .../api/app/lib/controllers/camera/create.js | 38 +++++ .../api/app/lib/controllers/camera/index.js | 7 +- .../api/app/lib/utils/rtmp2others.js | 19 ++- code/VideoAccess-VCMP/web/config.js | 2 +- code/VideoAccess-VCMP/web/package.json | 150 +++++++++--------- 5 files changed, 134 insertions(+), 82 deletions(-) create mode 100644 code/VideoAccess-VCMP/api/app/lib/controllers/camera/create.js diff --git a/code/VideoAccess-VCMP/api/app/lib/controllers/camera/create.js b/code/VideoAccess-VCMP/api/app/lib/controllers/camera/create.js new file mode 100644 index 0000000..5f3c581 --- /dev/null +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/camera/create.js @@ -0,0 +1,38 @@ +'use strict'; + +async function createYingshi (ctx) { + try { + const { models } = ctx.fs.dc + const { userId, token } = ctx.fs.api + + const { id, name, cloudControl, highDefinition, memoryCard, + voice, kindId, abilityId, rtmp, } = ctx.request.body + + let storageData = { + type: 'yingshi', name, cloudControl, highDefinition, memoryCard, + voice, longitude, latitude, kindId, abilityId, rtmp, + } + + if (id) { + storageData.createTime = moment().format() + storageData.createUserId = userId + await models.Camera.update(storageData, { + where: { + id, + } + }) + } else { + await models.Camera.create(storageData) + } + + ctx.status = 204; + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = {} + } +} + +module.exports = { + +}; \ No newline at end of file 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 52ac91f..12d3558 100644 --- a/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js @@ -149,11 +149,16 @@ async function detail (ctx) { const otherUrls = await rtmp2others(cameraRes.rtmp) + const corUser = await ctx.app.fs.authRequest.get(`user/${cameraRes.createUserId}/message`, { query: { token } }) + ctx.status = 200; ctx.body = { ...cameraRes.dataValues, station: bindStations, - videoUrl: otherUrls + videoUrl: otherUrls, + createUser: { + namePresent: corUser[0].namePresent + } } } catch (error) { ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); diff --git a/code/VideoAccess-VCMP/api/app/lib/utils/rtmp2others.js b/code/VideoAccess-VCMP/api/app/lib/utils/rtmp2others.js index 157d06c..e17d112 100644 --- a/code/VideoAccess-VCMP/api/app/lib/utils/rtmp2others.js +++ b/code/VideoAccess-VCMP/api/app/lib/utils/rtmp2others.js @@ -4,11 +4,20 @@ async function rtmp2others (rtmp) { return { liveUrl: { - rtmp: 'xx', - hls: 'xx', - flv: 'xx', - ezopen: 'xx', - onvif: 'xx', + hd: {// 高清 + rtmp: 'xx', + hls: 'xx', + flv: 'xx', + ezopen: 'xx', + onvif: 'xx', + }, + sd: {// 标清 + rtmp: 'xx', + hls: 'xx', + flv: 'xx', + ezopen: 'xx', + onvif: 'xx', + } }, replayUrl: { cloud: 'xx', diff --git a/code/VideoAccess-VCMP/web/config.js b/code/VideoAccess-VCMP/web/config.js index a6a0848..2f9a214 100644 --- a/code/VideoAccess-VCMP/web/config.js +++ b/code/VideoAccess-VCMP/web/config.js @@ -12,7 +12,7 @@ dev && console.log('\x1B[33m%s\x1b[0m', '请遵循并及时更新 readme.md, // // 启动参数 args.option(['p', 'port'], '启动端口'); args.option(['u', 'api-url'], 'webapi的URL'); -args.option('apiAuthUrl', 'apiAuthUrl'); +args.option('apiAuthUrl', 'IOT 鉴权 api'); const flags = args.parse(process.argv); diff --git a/code/VideoAccess-VCMP/web/package.json b/code/VideoAccess-VCMP/web/package.json index 9638a48..18c2116 100644 --- a/code/VideoAccess-VCMP/web/package.json +++ b/code/VideoAccess-VCMP/web/package.json @@ -1,76 +1,76 @@ { - "name": "fs-anxincloud-4.0", - "version": "1.0.0", - "description": "anxincloud-4.0", - "main": "server.js", - "scripts": { - "test": "mocha", - "start-vite": "cross-env NODE_ENV=developmentVite npm run start-params", - "start": "cross-env NODE_ENV=development npm run start-params", - "start-params": "node server -p 5000 -u http://10.8.30.82:4000 --apiAuthUrl http://10.8.30.82:4200", - "deploy": "export NODE_ENV=production&& npm run build && node server", - "build-dev": "export NODE_ENV=development&&webpack --config webpack.config.js", - "build": "export NODE_ENV=production&&webpack --config webpack.config.prod.js" - }, - "keywords": [ - "app" - ], - "author": "", - "license": "ISC", - "devDependencies": { - "@babel/core": "^7.14.6", - "@babel/plugin-proposal-class-properties": "^7.14.5", - "@babel/plugin-proposal-object-rest-spread": "^7.14.7", - "@babel/plugin-transform-runtime": "^7.14.5", - "@babel/polyfill": "^7.12.1", - "@babel/preset-env": "^7.14.7", - "@babel/preset-react": "^7.14.5", - "babel-loader": "^8.2.2", - "babel-plugin-import": "^1.13.3", - "connected-react-router": "^6.8.0", - "css-loader": "^3.5.0", - "express": "^4.17.1", - "file-loader": "^6.0.0", - "html-webpack-plugin": "^4.5.0", - "immutable": "^4.0.0-rc.12", - "less": "^3.12.2", - "less-loader": "^7.0.2", - "nprogress": "^0.2.0", - "react": "^17.0.0", - "react-dom": "^17.0.0", - "react-redux": "^7.2.1", - "react-router-dom": "^5.2.0", - "react-router-redux": "^4.0.8", - "redux": "^4.0.5", - "redux-thunk": "^2.3.0", - "style-loader": "^2.0.0", - "vite": "^2.9.5", - "webpack": "^5.3.2", - "webpack-bundle-analyzer": "^4.1.0", - "webpack-cli": "^4.2.0", - "webpack-dev-middleware": "^4.0.2", - "webpack-dev-server": "^3.11.2", - "webpack-hot-middleware": "^2.25.0" - }, - "dependencies": { - "@douyinfe/semi-ui": "^2.8.0", - "@fs/attachment": "^1.0.0", - "@peace/components": "0.0.35", - "@peace/utils": "^0.0.48", - "@vitejs/plugin-react": "^1.3.1", - "@vitejs/plugin-react-refresh": "^1.3.6", - "args": "^5.0.1", - "copy-to-clipboard": "^3.3.1", - "cross-env": "^7.0.3", - "fs-web-server-scaffold": "^1.0.6", - "koa-better-http-proxy": "^0.2.5", - "koa-proxy": "^1.0.0-alpha.3", - "koa-view": "^2.1.4", - "moment": "^2.29.3", - "npm": "^7.20.6", - "perfect-scrollbar": "^1.5.5", - "socket.io-client": "^4.5.0", - "socket.io-parser": "^4.2.0", - "superagent": "^6.1.0" - } -} + "name": "fs-anxincloud-4.0", + "version": "1.0.0", + "description": "anxincloud-4.0", + "main": "server.js", + "scripts": { + "test": "mocha", + "start-vite": "cross-env NODE_ENV=developmentVite npm run start-params", + "start": "cross-env NODE_ENV=development npm run start-params", + "start-params": "node server -p 5000 -u http://10.8.30.82:4000 --apiAuthUrl http://10.8.30.82:4200", + "deploy": "export NODE_ENV=production&& npm run build && node server", + "build-dev": "cross-env NODE_ENV=development&&webpack --config webpack.config.js", + "build": "export NODE_ENV=production&&webpack --config webpack.config.prod.js" + }, + "keywords": [ + "app" + ], + "author": "", + "license": "ISC", + "devDependencies": { + "@babel/core": "^7.14.6", + "@babel/plugin-proposal-class-properties": "^7.14.5", + "@babel/plugin-proposal-object-rest-spread": "^7.14.7", + "@babel/plugin-transform-runtime": "^7.14.5", + "@babel/polyfill": "^7.12.1", + "@babel/preset-env": "^7.14.7", + "@babel/preset-react": "^7.14.5", + "babel-loader": "^8.2.2", + "babel-plugin-import": "^1.13.3", + "connected-react-router": "^6.8.0", + "css-loader": "^3.5.0", + "express": "^4.17.1", + "file-loader": "^6.0.0", + "html-webpack-plugin": "^4.5.0", + "immutable": "^4.0.0-rc.12", + "less": "^3.12.2", + "less-loader": "^7.0.2", + "nprogress": "^0.2.0", + "react": "^17.0.0", + "react-dom": "^17.0.0", + "react-redux": "^7.2.1", + "react-router-dom": "^5.2.0", + "react-router-redux": "^4.0.8", + "redux": "^4.0.5", + "redux-thunk": "^2.3.0", + "style-loader": "^2.0.0", + "vite": "^2.9.5" + }, + "dependencies": { + "@douyinfe/semi-ui": "^2.8.0", + "@fs/attachment": "^1.0.0", + "@peace/components": "0.0.35", + "@peace/utils": "^0.0.48", + "@vitejs/plugin-react": "^1.3.1", + "@vitejs/plugin-react-refresh": "^1.3.6", + "args": "^5.0.1", + "copy-to-clipboard": "^3.3.1", + "cross-env": "^7.0.3", + "fs-web-server-scaffold": "^1.0.6", + "koa-better-http-proxy": "^0.2.5", + "koa-proxy": "^1.0.0-alpha.3", + "koa-view": "^2.1.4", + "moment": "^2.29.3", + "npm": "^7.20.6", + "perfect-scrollbar": "^1.5.5", + "socket.io-client": "^4.5.0", + "socket.io-parser": "^4.2.0", + "superagent": "^6.1.0", + "webpack": "^5.3.2", + "webpack-bundle-analyzer": "^4.1.0", + "webpack-cli": "^4.2.0", + "webpack-dev-middleware": "^4.0.2", + "webpack-dev-server": "^3.11.2", + "webpack-hot-middleware": "^2.25.0" + } +} \ No newline at end of file