Browse Source

api -u

release_0.0.1
yuan_yi 3 years ago
parent
commit
255466ef39
  1. 23
      code/VideoAccess-VCMP/api/app/lib/controllers/vender/index.js
  2. 8
      code/VideoAccess-VCMP/api/app/lib/routes/vender/index.js
  3. 5
      code/VideoAccess-VCMP/web/client/src/layout/actions/global.js
  4. 2
      code/VideoAccess-VCMP/web/package.json

23
code/VideoAccess-VCMP/api/app/lib/controllers/vender/index.js

@ -0,0 +1,23 @@
'use strict';
async function get (ctx) {
const models = ctx.fs.dc.models;
try {
const res = await models.Vender.findAll({
order: [
['id', 'ASC']
]
})
ctx.status = 200;
ctx.body = res
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {}
}
}
module.exports = {
get,
};

8
code/VideoAccess-VCMP/api/app/lib/routes/vender/index.js

@ -0,0 +1,8 @@
'use strict';
const vender = require('../../controllers/vender');
module.exports = function (app, router, opts) {
app.fs.api.logAttr['GET/vender'] = { content: '获取设备厂商', visible: false };
router.get('/vender', vender.get);
};

5
code/VideoAccess-VCMP/web/client/src/layout/actions/global.js

@ -2,6 +2,8 @@
import { RouteRequest } from '@peace/utils';
import { RouteTable } from '$utils'
import io from 'socket.io-client';
export const INIT_LAYOUT = 'INIT_LAYOUT';
export function initLayout (title, copyright, sections, actions) {
return {
@ -33,6 +35,9 @@ export function initApiRoot () {
return dispatch => {
RouteRequest.get(RouteTable.apiRoot).then(res => {
localStorage.setItem('apiRoot', res.root);
// const socket = io('ws://127.0.0.1:4000', () => { });
dispatch({
type: INIT_API_ROOT,
payload: {

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

@ -7,7 +7,7 @@
"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://127.0.0.1:4000 --apiAuthUrl http://10.8.30.82:4200",
"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"

Loading…
Cancel
Save