Browse Source

获取nvr的接口

release_0.0.1
yuan_yi 3 years ago
parent
commit
685f65affd
  1. 32
      code/VideoAccess-VCMP/api/app/lib/controllers/nvr/index.js
  2. 3
      code/VideoAccess-VCMP/api/app/lib/routes/nvr/index.js
  3. BIN
      code/VideoAccess-VCMP/web/client/assets/images/background/user_login.png

32
code/VideoAccess-VCMP/api/app/lib/controllers/nvr/index.js

@ -43,6 +43,37 @@ async function edit (ctx, next) {
}
}
async function get (ctx) {
const models = ctx.fs.dc.models;
try {
const { limit, offset, orderBy, orderDirection } = ctx.query
let findOption = {
order: [
[orderBy || 'id', orderDirection || 'DESC']
]
}
if (limit) {
findOption.limit = limit
}
if (offset) {
findOption.offset = offset
}
const res = await models.Nvr.findAll(findOption)
const total = await models.Nvr.count()
ctx.status = 200;
ctx.body = {
total: total,
data: res
}
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {}
}
}
async function del (ctx, next) {
try {
const models = ctx.fs.dc.models;
@ -64,5 +95,6 @@ async function del (ctx, next) {
module.exports = {
edit,
get,
del,
};

3
code/VideoAccess-VCMP/api/app/lib/routes/nvr/index.js

@ -6,6 +6,9 @@ module.exports = function (app, router, opts) {
app.fs.api.logAttr['POST/nvr'] = { content: '添加/修改nvr', visible: false };
router.post('/nvr', nvr.edit);
app.fs.api.logAttr['GET/nvr'] = { content: '获取nvr', visible: false };
router.get('/nvr', nvr.get);
app.fs.api.logAttr['DEL/nvr'] = { content: '删除nvr', visible: false };
router.del('/nvr/:nvrId', nvr.del);
};

BIN
code/VideoAccess-VCMP/web/client/assets/images/background/user_login.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Loading…
Cancel
Save