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 5bb4373..1c00233 100644 --- a/code/VideoAccess-VCMP/api/app/lib/controllers/nvr/index.js +++ b/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, }; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/app/lib/routes/nvr/index.js b/code/VideoAccess-VCMP/api/app/lib/routes/nvr/index.js index ed6654c..6e4d6a9 100644 --- a/code/VideoAccess-VCMP/api/app/lib/routes/nvr/index.js +++ b/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); }; diff --git a/code/VideoAccess-VCMP/web/client/assets/images/background/user_login.png b/code/VideoAccess-VCMP/web/client/assets/images/background/user_login.png new file mode 100644 index 0000000..151e68e Binary files /dev/null and b/code/VideoAccess-VCMP/web/client/assets/images/background/user_login.png differ