diff --git a/code/VideoAccess-VCMP/api/app/lib/controllers/camera/create.js b/code/VideoAccess-VCMP/api/app/lib/controllers/camera/create.js index 4aa16a9..3af5b2e 100644 --- a/code/VideoAccess-VCMP/api/app/lib/controllers/camera/create.js +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/camera/create.js @@ -4,6 +4,7 @@ const moment = require('moment') async function createYingshi (ctx) { let errMsg = '添加萤石摄像头失败' + const transaction = await ctx.fs.dc.orm.transaction(); try { const { models } = ctx.fs.dc const { userId, token } = ctx.fs.api @@ -13,6 +14,7 @@ async function createYingshi (ctx) { id, name, cloudControl, highDefinition, memoryCard, voice, kindId, abilityId, rtmp, serialNo, longitude, latitude, } = ctx.request.body; + let handleCameraId = id const serialNo_ = String(serialNo).toUpperCase() const secretRes = await models.SecretYingshi.findAll() @@ -39,25 +41,52 @@ async function createYingshi (ctx) { let storageData = { type: 'yingshi', name, cloudControl, highDefinition, memoryCard, - voice, longitude, latitude, kindId, abilityId, rtmp, + voice, longitude, latitude, kindId, rtmp, + serialNo: serialNo_, yingshiSecretId: cameraBeloneSecretId } - if (id) { + if (handleCameraId) { await models.Camera.update(storageData, { where: { - id, - } + id: handleCameraId, + }, + transaction }) } else { storageData.createTime = moment().format() storageData.createUserId = userId storageData.forbidden = false - await models.Camera.create(storageData) + const createRes = await models.Camera.create(storageData, { + transaction + }) + handleCameraId = createRes.id } + await models.CameraAbilityBind.destroy({ + where: { + cameraId: handleCameraId + }, + transaction + }) + if (abilityId && handleCameraId) { + let storageData = abilityId.map(aid => { + return { + cameraId: handleCameraId, + abilityId: aid + } + }) + if (storageData.length) { + await models.CameraAbilityBind.bulkCreate(storageData, { + transaction + }) + } + } + + await transaction.commit(); ctx.status = 204; } catch (error) { + await transaction.rollback(); ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.status = 400; ctx.body = { @@ -172,36 +201,65 @@ async function createNvrCamera (ctx) { } async function createIpcCamera (ctx) { + const transaction = await ctx.fs.dc.orm.transaction(); try { const { models } = ctx.fs.dc const { userId, token } = ctx.fs.api const { id, name, cloudControl, memoryCard, - voice, longitude, latitude, rtmp, + voice, longitude, latitude, venderId, rtmp, serialNo, kindId, abilityId, } = ctx.request.body; + let handleCameraId = id let storageData = { type: 'ipc', name, cloudControl, memoryCard, - voice, longitude, latitude, rtmp, - serialNo, kindId, abilityId, + voice, longitude, latitude, rtmp, venderId, + serialNo, kindId, } - if (id) { + if (handleCameraId) { await models.Camera.update(storageData, { where: { - id, - } + id: handleCameraId, + }, + transaction }) } else { storageData.createTime = moment().format() storageData.createUserId = userId storageData.forbidden = false - await models.Camera.create(storageData) + const createRes = await models.Camera.create(storageData, { + transaction + }) + handleCameraId = createRes.id } + + await models.CameraAbilityBind.destroy({ + where: { + cameraId: handleCameraId + }, + transaction + }) + if (abilityId && handleCameraId) { + let storageData = abilityId.map(aid => { + return { + cameraId: handleCameraId, + abilityId: aid + } + }) + if (storageData.length) { + await models.CameraAbilityBind.bulkCreate(storageData, { + transaction + }) + } + } + + await transaction.commit(); ctx.status = 204; } catch (error) { + await transaction.rollback(); ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.status = 400; ctx.body = {} diff --git a/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js b/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js index f55dd01..4efc107 100644 --- a/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js @@ -19,11 +19,12 @@ async function getCameraProject (ctx, next) { [orderBy || 'id', orderDirection || 'DESC'] ], include: [{ - model: models.CameraAbility - }, { model: models.CameraKind }] } + let abilityFind = { + model: models.CameraAbility + } if (limit) { findOption.limit = limit } @@ -40,13 +41,16 @@ async function getCameraProject (ctx, next) { if (type) { findOption.where.type = type } - if (abilityId) { - findOption.where.abilityId = abilityId - } if (venderId) { findOption.where.venderId = venderId } + if (abilityId) { + abilityFind.where = { + abilityId: abilityId + } + } + findOption.include.push(abilityFind) const cameraRes = await models.Camera.findAll(findOption) const total = await models.Camera.count({ where: findOption.where @@ -356,10 +360,10 @@ async function cameraExport (ctx) { exportData.push(camera) } - - const filePath = await simpleExcelDown({ data: exportData, header, fileName: `摄像头信息列表_${userId}_${moment().format('YYYYMMDDHHmmss')}` }) + const fileName = `摄像头信息列表_${userId}_${moment().format('YYYYMMDDHHmmss')}` + '.csv' + const filePath = await simpleExcelDown({ data: exportData, header, fileName: fileName }) const fileData = fs.readFileSync(filePath); - let fileName = filePath.split('/').pop() + ctx.status = 200; ctx.set('Content-Type', 'application/x-xls'); ctx.set('Content-disposition', 'attachment; filename=' + encodeURI(fileName)); 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 cbe4cda..01d58a6 100644 --- a/code/VideoAccess-VCMP/api/app/lib/controllers/nvr/index.js +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/nvr/index.js @@ -3,16 +3,34 @@ const fs = require('fs'); const moment = require('moment') async function edit (ctx, next) { + let errMsg = '添加 NVR 设备失败' const transaction = await ctx.fs.dc.orm.transaction(); try { - const models = ctx.fs.dc.models; + const { utils: { getCameraLevel3ByStreamId } } = ctx.app.fs + const { models } = ctx.fs.dc; const { userId } = ctx.fs.api const data = ctx.request.body; + const { serialNo } = data + + const nvrGbRes = await models.GbCamera.findOne({ + where: { + streamid: serialNo, + level: 0 + } + }) + + if (!nvrGbRes) { + errMsg = '没有找到已接入的 NVR 服务信息' + throw errMsg + } + + const channelRes = await getCameraLevel3ByStreamId(serialNo) // 或取其他服务信息 const nvrData = { - channelCount: 8, + channelCount: channelRes.length, port: 8080, + sip: nvrGbRes.sipip, } if (data.id) { @@ -57,7 +75,13 @@ async function get (ctx) { }, order: [ [orderBy || 'id', orderDirection || 'DESC'] - ] + ], + include: [{ + model: models.GbCamera, + as: 'gbNvr', + // attributes: ['id', 'address', 'name', 'online'], + required: false + }] } if (limit) { findOption.limit = limit @@ -183,6 +207,11 @@ async function detail (ctx) { }, include: [{ model: models.Vender + }, { + model: models.GbCamera, + as: 'gbNvr', + // attributes: ['id', 'address', 'name', 'online', 'registerTime', 'updateTime'], + required: false }] }) @@ -339,9 +368,9 @@ async function nvrExport (ctx) { exportData.push(n) } - const filePath = await simpleExcelDown({ data: exportData, header, fileName: `NVR信息列表_${userId}_${moment().format('YYYYMMDDHHmmss')}` }) + const fileName = `NVR信息列表_${userId}_${moment().format('YYYYMMDDHHmmss')}` + '.csv' + const filePath = await simpleExcelDown({ data: exportData, header, fileName: fileName }) const fileData = fs.readFileSync(filePath); - let fileName = filePath.split('/').pop() ctx.status = 200; ctx.set('Content-Type', 'application/x-xls'); ctx.set('Content-disposition', 'attachment; filename=' + encodeURI(fileName)); diff --git a/code/VideoAccess-VCMP/api/app/lib/index.js b/code/VideoAccess-VCMP/api/app/lib/index.js index 1cc982d..cd19130 100644 --- a/code/VideoAccess-VCMP/api/app/lib/index.js +++ b/code/VideoAccess-VCMP/api/app/lib/index.js @@ -39,6 +39,7 @@ module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Seq require('./models/camera_ability')(dc); require('./models/camera_kind')(dc); require('./models/camera')(dc); + require('./models/camera_ability_bind')(dc); require('./models/nvr')(dc); require('./models/vender')(dc); require('./models/secret_yingshi')(dc); diff --git a/code/VideoAccess-VCMP/api/app/lib/models/camera.js b/code/VideoAccess-VCMP/api/app/lib/models/camera.js index ab32d09..fcbe158 100644 --- a/code/VideoAccess-VCMP/api/app/lib/models/camera.js +++ b/code/VideoAccess-VCMP/api/app/lib/models/camera.js @@ -234,19 +234,6 @@ module.exports = dc => { model: "cameraKind" } }, - abilityId: { - type: DataTypes.INTEGER, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "ability_id", - autoIncrement: false, - references: { - key: "id", - model: "cameraAbility" - } - }, yingshiSecretId: { type: DataTypes.INTEGER, allowNull: true, @@ -271,9 +258,5 @@ module.exports = dc => { Camera.belongsTo(CameraKind, { foreignKey: 'kindId', targetKey: 'id' }); CameraKind.hasMany(Camera, { foreignKey: 'kindId', sourceKey: 'id' }); - const CameraAbility = dc.models.CameraAbility; - Camera.belongsTo(CameraAbility, { foreignKey: 'abilityId', targetKey: 'id' }); - CameraAbility.hasMany(Camera, { foreignKey: 'abilityId', sourceKey: 'id' }); - return Camera; }; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/app/lib/models/camera_ability.js b/code/VideoAccess-VCMP/api/app/lib/models/camera_ability.js index 6e572f9..bc12417 100644 --- a/code/VideoAccess-VCMP/api/app/lib/models/camera_ability.js +++ b/code/VideoAccess-VCMP/api/app/lib/models/camera_ability.js @@ -2,33 +2,33 @@ 'use strict'; module.exports = dc => { - const DataTypes = dc.ORM; - const sequelize = dc.orm; - const CameraAbility = sequelize.define("cameraAbility", { - id: { - type: DataTypes.INTEGER, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: true, - field: "id", - autoIncrement: false, - unique: "camera_ability_id_uindex" - }, - ability: { - type: DataTypes.STRING, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: false, - field: "ability", - autoIncrement: false - } - }, { - tableName: "camera_ability", - comment: "", - indexes: [] - }); - dc.models.CameraAbility = CameraAbility; - return CameraAbility; + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const CameraAbility = sequelize.define("cameraAbility", { + id: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: true, + field: "id", + autoIncrement: false, + unique: "camera_ability_id_uindex" + }, + ability: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "ability", + autoIncrement: false + } + }, { + tableName: "camera_ability", + comment: "", + indexes: [] + }); + dc.models.CameraAbility = CameraAbility; + return CameraAbility; }; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/app/lib/models/camera_ability_bind.js b/code/VideoAccess-VCMP/api/app/lib/models/camera_ability_bind.js new file mode 100644 index 0000000..e8f46be --- /dev/null +++ b/code/VideoAccess-VCMP/api/app/lib/models/camera_ability_bind.js @@ -0,0 +1,56 @@ +/* eslint-disable*/ +'use strict'; + +module.exports = dc => { + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const CameraAbilityBind = sequelize.define("cameraAbilityBind", { + id: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: true, + field: "id", + autoIncrement: true, + unique: "camera_ability_bind_id_uindex" + }, + cameraId: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "camera_id", + autoIncrement: false, + references: { + key: "id", + model: "camera" + } + }, + abilityId: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "ability_id", + autoIncrement: false, + references: { + key: "id", + model: "cameraAbility" + } + } + }, { + tableName: "camera_ability_bind", + comment: "", + indexes: [] + }); + dc.models.CameraAbilityBind = CameraAbilityBind; + + const Camera = dc.models.Camera; + const CameraAbility = dc.models.CameraAbility; + Camera.belongsToMany(CameraAbility, { through: CameraAbilityBind, foreignKey: 'cameraId', otherKey: 'abilityId' }); + + return CameraAbilityBind; +}; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/app/lib/models/gb_camera.js b/code/VideoAccess-VCMP/api/app/lib/models/gb_camera.js index 7625deb..f4ea183 100644 --- a/code/VideoAccess-VCMP/api/app/lib/models/gb_camera.js +++ b/code/VideoAccess-VCMP/api/app/lib/models/gb_camera.js @@ -2,141 +2,146 @@ 'use strict'; module.exports = dc => { - const DataTypes = dc.ORM; - const sequelize = dc.orm; - const GbCamera = sequelize.define("gbCamera", { - id: { - type: DataTypes.INTEGER, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: true, - field: "id", - autoIncrement: true, - unique: "gbcamera_id_uindex" - }, - level: { - type: DataTypes.INTEGER, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "level", - autoIncrement: false - }, - parent: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "parent", - autoIncrement: false - }, - streamid: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "streamid", - autoIncrement: false - }, - registerTime: { - type: DataTypes.DATEONLY, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "registerTime", - autoIncrement: false - }, - updateTime: { - type: DataTypes.DATEONLY, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "updateTime", - autoIncrement: false - }, - online: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "online", - autoIncrement: false - }, - manufactuer: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "manufactuer", - autoIncrement: false - }, - model: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "model", - autoIncrement: false - }, - civilCode: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "civilCode", - autoIncrement: false - }, - adddress: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "adddress", - autoIncrement: false - }, - name: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "name", - autoIncrement: false - }, - addr: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "Addr", - autoIncrement: false - }, - sipip: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: null, - primaryKey: false, - field: "Sipip", - autoIncrement: false - } - }, { - tableName: "gbCamera", - comment: "", - indexes: [] - }); - dc.models.GbCamera = GbCamera; - return GbCamera; + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const GbCamera = sequelize.define("gbCamera", { + id: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: true, + field: "id", + autoIncrement: true, + unique: "gbcamera_id_uindex" + }, + level: { + type: DataTypes.INTEGER, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "level", + autoIncrement: false + }, + parent: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "parent", + autoIncrement: false + }, + streamid: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "streamid", + autoIncrement: false + }, + registerTime: { + type: DataTypes.DATEONLY, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "registerTime", + autoIncrement: false + }, + updateTime: { + type: DataTypes.DATEONLY, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "updateTime", + autoIncrement: false + }, + online: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "online", + autoIncrement: false + }, + manufactuer: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "manufactuer", + autoIncrement: false + }, + model: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "model", + autoIncrement: false + }, + civilCode: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "civilCode", + autoIncrement: false + }, + adddress: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "adddress", + autoIncrement: false + }, + name: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "name", + autoIncrement: false + }, + addr: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "Addr", + autoIncrement: false + }, + sipip: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "Sipip", + autoIncrement: false + } + }, { + tableName: "gbCamera", + comment: "", + indexes: [] + }); + dc.models.GbCamera = GbCamera; + + const Nvr = dc.models.Nvr; + Nvr.belongsTo(GbCamera, { foreignKey: 'serialNo', targetKey: 'streamid', as: 'gbNvr' }); + GbCamera.hasMany(Nvr, { foreignKey: 'serialNo', sourceKey: 'streamid', as: 'gbNvr' }); + + return GbCamera; }; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/app/lib/models/nvr.js b/code/VideoAccess-VCMP/api/app/lib/models/nvr.js index 8caf2d1..1086433 100644 --- a/code/VideoAccess-VCMP/api/app/lib/models/nvr.js +++ b/code/VideoAccess-VCMP/api/app/lib/models/nvr.js @@ -2,127 +2,127 @@ 'use strict'; module.exports = dc => { - const DataTypes = dc.ORM; - const sequelize = dc.orm; - const Nvr = sequelize.define("nvr", { - id: { - type: DataTypes.INTEGER, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: true, - field: "id", - autoIncrement: true, - unique: "nvr_id_uindex" - }, - name: { - type: DataTypes.STRING, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: false, - field: "name", - autoIncrement: false - }, - venderId: { - type: DataTypes.INTEGER, - allowNull: true, - defaultValue: null, - comment: "设备厂家id", - primaryKey: false, - field: "vender_id", - autoIncrement: false, - references: { - key: "id", - model: "vender" + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const Nvr = sequelize.define("nvr", { + id: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: true, + field: "id", + autoIncrement: true, + unique: "nvr_id_uindex" + }, + name: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "name", + autoIncrement: false + }, + venderId: { + type: DataTypes.INTEGER, + allowNull: true, + defaultValue: null, + comment: "设备厂家id", + primaryKey: false, + field: "vender_id", + autoIncrement: false, + references: { + key: "id", + model: "vender" + } + }, + serialNo: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: "设备编号", + primaryKey: false, + field: "serial_no", + autoIncrement: false + }, + regionCode: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "行政区码", + primaryKey: false, + field: "region_code", + autoIncrement: false + }, + longitude: { + type: DataTypes.DOUBLE, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "longitude", + autoIncrement: false + }, + latitude: { + type: DataTypes.DOUBLE, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "latitude", + autoIncrement: false + }, + createTime: { + type: DataTypes.DATE, + allowNull: false, + defaultValue: sequelize.fn('now'), + comment: "创建时间", + primaryKey: false, + field: "create_time", + autoIncrement: false + }, + channelCount: { + type: DataTypes.INTEGER, + allowNull: true, + defaultValue: null, + comment: "通道数", + primaryKey: false, + field: "channel_count", + autoIncrement: false + }, + port: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "端口", + primaryKey: false, + field: "port", + autoIncrement: false + }, + delete: { + type: DataTypes.BOOLEAN, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "delete", + autoIncrement: false + }, + createUserId: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "create_user_id", + autoIncrement: false } - }, - serialNo: { - type: DataTypes.STRING, - allowNull: false, - defaultValue: null, - comment: "设备编号", - primaryKey: false, - field: "serial_no", - autoIncrement: false - }, - regionCode: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: "行政区码", - primaryKey: false, - field: "region_code", - autoIncrement: false - }, - longitude: { - type: DataTypes.DOUBLE, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: false, - field: "longitude", - autoIncrement: false - }, - latitude: { - type: DataTypes.DOUBLE, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: false, - field: "latitude", - autoIncrement: false - }, - createTime: { - type: DataTypes.DATE, - allowNull: false, - defaultValue: sequelize.fn('now'), - comment: "创建时间", - primaryKey: false, - field: "create_time", - autoIncrement: false - }, - channelCount: { - type: DataTypes.INTEGER, - allowNull: true, - defaultValue: null, - comment: "通道数", - primaryKey: false, - field: "channel_count", - autoIncrement: false - }, - port: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: "端口", - primaryKey: false, - field: "port", - autoIncrement: false - }, - delete: { - type: DataTypes.BOOLEAN, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: false, - field: "delete", - autoIncrement: false - }, - createUserId: { - type: DataTypes.INTEGER, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: false, - field: "create_user_id", - autoIncrement: false - } - }, { - tableName: "nvr", - comment: "", - indexes: [] - }); - dc.models.Nvr = Nvr; - return Nvr; + }, { + tableName: "nvr", + comment: "", + indexes: [] + }); + dc.models.Nvr = Nvr; + return Nvr; }; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/app/lib/utils/xlsxDownload.js b/code/VideoAccess-VCMP/api/app/lib/utils/xlsxDownload.js index 614a669..266e64a 100644 --- a/code/VideoAccess-VCMP/api/app/lib/utils/xlsxDownload.js +++ b/code/VideoAccess-VCMP/api/app/lib/utils/xlsxDownload.js @@ -64,7 +64,7 @@ module.exports = function (app, opts) { } } - const savePath = path.join(fileDirPath, fileName + '.xlsx') + const savePath = path.join(fileDirPath, fileName) await new Promise(function (resolve, reject) { file.saveAs() .pipe(fs.createWriteStream(savePath)) diff --git a/code/VideoAccess-VCMP/api/sequelize-automate.config.js b/code/VideoAccess-VCMP/api/sequelize-automate.config.js index b5dc123..185e650 100644 --- a/code/VideoAccess-VCMP/api/sequelize-automate.config.js +++ b/code/VideoAccess-VCMP/api/sequelize-automate.config.js @@ -26,7 +26,7 @@ module.exports = { dir: './app/lib/models', // 指定输出 models 文件的目录 typesDir: 'models', // 指定输出 TypeScript 类型定义的文件目录,只有 TypeScript / Midway 等会有类型定义 emptyDir: false, // !!! 谨慎操作 生成 models 之前是否清空 `dir` 以及 `typesDir` - tables: ['gbCamera'], // 指定生成哪些表的 models,如 ['user', 'user_post'];如果为 null,则忽略改属性 + tables: ['camera_ability_bind'], // 指定生成哪些表的 models,如 ['user', 'user_post'];如果为 null,则忽略改属性 skipTables: [], // 指定跳过哪些表的 models,如 ['user'];如果为 null,则忽略改属性 tsNoCheck: false, // 是否添加 `@ts-nocheck` 注释到 models 文件中 ignorePrefix: [], // 生成的模型名称忽略的前缀,因为 项目中有以下表名是以 t_ 开头的,在实际模型中不需要, 可以添加多个 [ 't_data_', 't_',] ,长度较长的 前缀放前面 diff --git a/code/VideoAccess-VCMP/web/client/assets/images/background/building.jpg b/code/VideoAccess-VCMP/web/client/assets/images/background/building.jpg new file mode 100644 index 0000000..57a7282 Binary files /dev/null and b/code/VideoAccess-VCMP/web/client/assets/images/background/building.jpg differ diff --git a/code/VideoAccess-VCMP/web/client/src/components/coming.jsx b/code/VideoAccess-VCMP/web/client/src/components/coming.jsx new file mode 100644 index 0000000..e2f7d95 --- /dev/null +++ b/code/VideoAccess-VCMP/web/client/src/components/coming.jsx @@ -0,0 +1,22 @@ +import React from "react"; + +const Coming = () => { + return ( +