'use strict'; const MainService = require('../main'); class CameraServerService extends MainService { constructor(ctx) { super(ctx); const _noNeedLogin = ''; const _noNeedRight = 'list,detail'; const _noNeedLog = '*'; const _noNeedAuth = 'list,detail'; this.systemInit(_noNeedLogin, _noNeedRight, _noNeedLog, _noNeedAuth); } async list(data) { try { const result = await this.service.systems.cameraServer.list(data || {}); return this.success('获取成功', result); } catch (e) { return this.fail(e.message); } } async detail(data) { try { const { id } = data || {}; if (!id) return this.fail('ID不能为空'); return this.success('获取成功', await this.service.systems.cameraServer.detail(parseInt(id))); } catch (e) { return this.fail(e.message); } } async create(data) { try { return this.success('创建成功', await this.service.systems.cameraServer.create(data)); } catch (e) { return this.fail(e.message); } } async update(data) { try { const { id, ...fields } = data || {}; if (!id) return this.fail('ID不能为空'); return this.success('更新成功', await this.service.systems.cameraServer.update(parseInt(id), fields)); } catch (e) { return this.fail(e.message); } } async delete(data) { try { const { id } = data || {}; if (!id) return this.fail('ID不能为空'); await this.service.systems.cameraServer.delete(parseInt(id)); return this.success('删除成功'); } catch (e) { return this.fail(e.message); } } } module.exports = CameraServerService;