Browse Source

webpack

release_0.0.2
yuan_yi 3 years ago
parent
commit
f638047ae7
  1. 38
      code/VideoAccess-VCMP/api/app/lib/controllers/camera/create.js
  2. 7
      code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js
  3. 9
      code/VideoAccess-VCMP/api/app/lib/utils/rtmp2others.js
  4. 2
      code/VideoAccess-VCMP/web/config.js
  5. 18
      code/VideoAccess-VCMP/web/package.json

38
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 = {
};

7
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}`);

9
code/VideoAccess-VCMP/api/app/lib/utils/rtmp2others.js

@ -4,12 +4,21 @@ async function rtmp2others (rtmp) {
return {
liveUrl: {
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',
local: 'xx',

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

18
code/VideoAccess-VCMP/web/package.json

@ -9,7 +9,7 @@
"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-dev": "cross-env NODE_ENV=development&&webpack --config webpack.config.js",
"build": "export NODE_ENV=production&&webpack --config webpack.config.prod.js"
},
"keywords": [
@ -44,13 +44,7 @@
"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"
"vite": "^2.9.5"
},
"dependencies": {
"@douyinfe/semi-ui": "^2.8.0",
@ -71,6 +65,12 @@
"perfect-scrollbar": "^1.5.5",
"socket.io-client": "^4.5.0",
"socket.io-parser": "^4.2.0",
"superagent": "^6.1.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"
}
}
Loading…
Cancel
Save