From 1381d67ed65e82316fe452028a68763b0336b109 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Fri, 15 Jul 2022 10:51:43 +0800 Subject: [PATCH] camera status --- .../api/app/lib/controllers/camera/index.js | 2 +- .../api/app/lib/controllers/status/index.js | 257 ++++++++++++++++++ .../api/app/lib/controllers/status/push.js | 85 ++++++ code/VideoAccess-VCMP/api/app/lib/index.js | 71 ++++- .../api/app/lib/models/ax_project.js | 5 - .../api/app/lib/models/camera.js | 8 - .../api/app/lib/models/camera_ability_bind.js | 4 - .../api/app/lib/models/camera_remark.js | 4 - .../api/app/lib/models/camera_status.js | 79 ++++++ .../api/app/lib/models/camera_status_log.js | 47 ++++ .../lib/models/camera_status_push_config.js | 79 ++++++ .../app/lib/models/camera_status_push_log.js | 61 +++++ .../lib/models/camera_status_push_monitor.js | 51 ++++ .../lib/models/camera_status_push_receiver.js | 47 ++++ .../app/lib/models/camera_status_resolve.js | 47 ++++ .../api/app/lib/models/gb_camera.js | 8 - .../api/app/lib/models/secret_yingshi.js | 4 - .../api/app/lib/models/vender.js | 66 ++--- .../api/app/lib/routes/status/index.js | 44 +++ .../api/app/lib/service/socket.js | 2 +- .../api/sequelize-automate.config.js | 2 +- .../script/.vscode/settings.json | 3 + .../.vscode/launch.json | 17 ++ .../data/1_update_status_code_data/index.js | 69 +++++ .../1_update_status_code_data/package.json | 16 ++ .../云录制错误码.xlsx | Bin 0 -> 12866 bytes .../client/src/layout/actions/webSocket.js | 2 +- code/VideoAccess-VCMP/web/config.js | 4 +- code/VideoAccess-VCMP/web/package.json | 2 +- 29 files changed, 995 insertions(+), 91 deletions(-) create mode 100644 code/VideoAccess-VCMP/api/app/lib/controllers/status/index.js create mode 100644 code/VideoAccess-VCMP/api/app/lib/controllers/status/push.js create mode 100644 code/VideoAccess-VCMP/api/app/lib/models/camera_status.js create mode 100644 code/VideoAccess-VCMP/api/app/lib/models/camera_status_log.js create mode 100644 code/VideoAccess-VCMP/api/app/lib/models/camera_status_push_config.js create mode 100644 code/VideoAccess-VCMP/api/app/lib/models/camera_status_push_log.js create mode 100644 code/VideoAccess-VCMP/api/app/lib/models/camera_status_push_monitor.js create mode 100644 code/VideoAccess-VCMP/api/app/lib/models/camera_status_push_receiver.js create mode 100644 code/VideoAccess-VCMP/api/app/lib/models/camera_status_resolve.js create mode 100644 code/VideoAccess-VCMP/api/app/lib/routes/status/index.js create mode 100644 code/VideoAccess-VCMP/script/.vscode/settings.json create mode 100644 code/VideoAccess-VCMP/script/1.1.1/data/1_update_status_code_data/.vscode/launch.json create mode 100644 code/VideoAccess-VCMP/script/1.1.1/data/1_update_status_code_data/index.js create mode 100644 code/VideoAccess-VCMP/script/1.1.1/data/1_update_status_code_data/package.json create mode 100644 code/VideoAccess-VCMP/script/1.1.1/data/1_update_status_code_data/云录制错误码.xlsx 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 b870386..c465c20 100644 --- a/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js @@ -284,7 +284,7 @@ async function banned (ctx) { const { models } = ctx.fs.dc; const data = ctx.request.body; - // 向视频服务发送通知 + // TODO 向视频服务发送通知 // 库记录 await models.Camera.update({ diff --git a/code/VideoAccess-VCMP/api/app/lib/controllers/status/index.js b/code/VideoAccess-VCMP/api/app/lib/controllers/status/index.js new file mode 100644 index 0000000..e566037 --- /dev/null +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/status/index.js @@ -0,0 +1,257 @@ +'use strict'; +const moment = require('moment') + +async function get (ctx) { + try { + const models = ctx.fs.dc.models; + const { userId, token } = ctx.fs.api + const { limit, page, orderBy, orderDirection, keyword, forbidden, paraphraseCustom } = ctx.query + + const sequelize = ctx.fs.dc.ORM; + let findOption = { + attributes: { + include: [ + [sequelize.fn('COUNT', sequelize.col('cameraStatusLogs.id')), 'logCount'] + ] + }, + where: {}, + order: [ + [orderBy || 'id', orderDirection || 'DESC'] + ], + distinct: true, + subQuery: false, + group: [ + 'cameraStatus.id', + 'cameraStatusLogs.status_id', + // 'cameraStatusResolves.id' + ], + include: [ + // { + // model: models.CameraStatusResolve, + // attributes: { exclude: ['statusId'] }, + // required: false, + // duplicating: true + // }, + { + model: models.CameraStatusLog, + attributes: [], + duplicating: false, + required: false, + } + ], + } + if (orderBy) { + if (orderBy == 'logCount') { + findOption.order = sequelize.literal(`"logCount" ${orderDirection || 'DESC'}`) + } + } + if (limit) { + findOption.limit = limit + } + if (page && limit) { + findOption.offset = page * limit + } + if (keyword) { + findOption.where['$or'] = { + describe: { + $like: `%${keyword}%` + }, + paraphrase: { + $like: `%${keyword}%` + }, + paraphraseCustom: { + $like: `%${keyword}%` + }, + } + } + if (forbidden) { + if (forbidden === 'true') { + findOption.where.forbidden = true + } else if (forbidden === 'false') { + findOption.where.forbidden = false + } + } + if (paraphraseCustom) { + if (paraphraseCustom === 'true') { + findOption.where.paraphraseCustom = null + } else if (paraphraseCustom === 'false') { + findOption.where.paraphraseCustom = { + $ne: null + } + } + } + + const statusRes = await models.CameraStatus.findAll(findOption) + + delete findOption.order + delete findOption.limit + delete findOption.offset + delete findOption.attributes + delete findOption.group + const count = await models.CameraStatus.count(findOption) + + const statusIds = statusRes.map(r => r.id) + const statusResolveRes = await models.CameraStatusResolve.findAll({ + where: { + statusId: { + $in: statusIds + } + } + }) + + for (let { dataValues: s } of statusRes) { + const corResolve = statusResolveRes.filter(r => r.statusId === s.id) + s.resolve = corResolve + } + + ctx.status = 200; + ctx.body = { + count, + rows: statusRes, + } + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = {} + } +} + +async function getSimpleAll (ctx) { + try { + const models = ctx.fs.dc.models; + const statusRes = await models.CameraStatus.findAll({ + attributes: ['id', 'platform', 'status', 'describe'], + }) + ctx.status = 200; + ctx.body = statusRes + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = {} + } +} + +async function banned (ctx) { + try { + const { models } = ctx.fs.dc; + const data = ctx.request.body; + + // 库记录 + await models.CameraStatus.update({ + forbidden: data.forbidden + }, { + where: { + id: data.statusId + } + }) + + ctx.status = 204; + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = {} + } +} + +async function paraphraseCustom (ctx) { + try { + const models = ctx.fs.dc.models; + const { userId, token } = ctx.fs.api + const data = ctx.request.body + + await models.CameraStatus.update({ + paraphraseCustom: data.paraphrase, + }, { + where: { + id: { $in: data.statusId } + } + }) + + ctx.status = 204; + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = {} + } +} + +async function resolveEdit (ctx) { + const transaction = await ctx.fs.dc.orm.transaction(); + try { + const models = ctx.fs.dc.models; + const { userId, token } = ctx.fs.api + const data = ctx.request.body + + await models.CameraStatusResolve.destroy({ + where: { + statusId: data.statusId + }, + transaction + }) + + await models.CameraStatusResolve.bulkCreate( + data.resolve.map(r => { + return { + statusId: data.statusId, + resolve: r + } + }), + { 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 = {} + } +} + +async function statusCheck (ctx) { + try { + const models = ctx.fs.dc.models; + const { userId, token } = ctx.fs.api + const { status, platform, describe } = ctx.query + + if (!status || !platform) { + throw 'status and platform is required' + } + + const statusRes = await models.CameraStatus.findOne({ + where: { + status, + platform, + }, + include: [{ + model: models.CameraStatusResolve, + attributes: { exclude: ['statusId'] }, + }], + }) + + if (!statusRes && describe) { + await models.CameraStatus.create({ + status, platform, describe + }) + } + + ctx.status = 200; + ctx.body = statusRes + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { + message: typeof error == 'string' ? error : undefined + } + } +} + +module.exports = { + get, + getSimpleAll, + banned, + paraphraseCustom, + resolveEdit, + statusCheck, +}; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/app/lib/controllers/status/push.js b/code/VideoAccess-VCMP/api/app/lib/controllers/status/push.js new file mode 100644 index 0000000..2a98d81 --- /dev/null +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/status/push.js @@ -0,0 +1,85 @@ +'use strict'; +const moment = require('moment') + +async function edit (ctx) { + try { + const models = ctx.fs.dc.models; + const { userId, token } = ctx.fs.api + + ctx.status = 204; + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = {} + } +} + +async function get (ctx) { + try { + const models = ctx.fs.dc.models; + const { userId, token } = ctx.fs.api + + ctx.status = 204; + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = {} + } +} + +async function banned (ctx) { + try { + const models = ctx.fs.dc.models; + const { userId, token } = ctx.fs.api + + ctx.status = 204; + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = {} + } +} + +async function del (ctx) { + try { + const models = ctx.fs.dc.models; + const { userId, token } = ctx.fs.api + + ctx.status = 204; + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = {} + } +} + +async function copy (ctx) { + try { + const models = ctx.fs.dc.models; + const { userId, token } = ctx.fs.api + + ctx.status = 204; + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = {} + } +} + +async function detail (ctx) { + try { + const models = ctx.fs.dc.models; + const { userId, token } = ctx.fs.api + + ctx.status = 204; + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = {} + } +} + + +module.exports = { + edit, get, banned, del, copy, detail +}; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/app/lib/index.js b/code/VideoAccess-VCMP/api/app/lib/index.js index b8a05ed..40f46c3 100644 --- a/code/VideoAccess-VCMP/api/app/lib/index.js +++ b/code/VideoAccess-VCMP/api/app/lib/index.js @@ -44,19 +44,60 @@ module.exports.entry = function (app, router, opts) { }; module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Sequelize, models: {} } - require('./models/nvr')(dc); - require('./models/camera_ability')(dc); - require('./models/camera_kind')(dc); - require('./models/camera')(dc); - require('./models/camera_ability_bind')(dc); - require('./models/vender')(dc); - require('./models/secret_yingshi')(dc); - require('./models/gb_camera')(dc); - require('./models/ax_project')(dc); - require('./models/camera_remark')(dc); - - // TODO 模型关系摘出来 初始化之后再定义关系才行 - // fs.readdirSync(path.join(__dirname, '/models')).forEach((filename) => { - // require(`./models/${filename}`)(dc) - // }); + // 加载定义模型 历史写法 + // require('./models/nvr')(dc); + // require('./models/camera_ability')(dc); + // require('./models/camera_kind')(dc); + // require('./models/camera')(dc); + // require('./models/camera_ability_bind')(dc); + // require('./models/vender')(dc); + // require('./models/secret_yingshi')(dc); + // require('./models/gb_camera')(dc); + // require('./models/ax_project')(dc); + // require('./models/camera_remark')(dc); + + // 模型关系摘出来 初始化之后再定义关系才行 + fs.readdirSync(path.join(__dirname, '/models')).forEach((filename) => { + require(`./models/${filename}`)(dc) + }); + + const { + Nvr, Camera, CameraAbility, CameraAbilityBind, CameraKind, CameraRemark, + GbCamera, SecretYingshi, Vender, CameraStatus, CameraStatusResolve, CameraStatusLog + } = dc.models; + + // Nvr.belongsTo(User, { foreignKey: 'userId', targetKey: 'id' }); + // User.hasMany(Nvr, { foreignKey: 'userId', sourceKey: 'id' }); + + Camera.belongsToMany(CameraAbility, { through: CameraAbilityBind, foreignKey: 'cameraId', otherKey: 'abilityId' }); + + CameraRemark.belongsTo(Camera, { foreignKey: 'cameraId', targetKey: 'id' }); + Camera.hasMany(CameraRemark, { foreignKey: 'cameraId', sourceKey: 'id' }); + + Camera.belongsTo(CameraKind, { foreignKey: 'kindId', targetKey: 'id' }); + CameraKind.hasMany(Camera, { foreignKey: 'kindId', sourceKey: 'id' }); + + Camera.belongsTo(Nvr, { foreignKey: 'nvrId', targetKey: 'id' }); + Nvr.hasMany(Camera, { foreignKey: 'nvrId', sourceKey: 'id' }); + + Nvr.belongsTo(GbCamera, { foreignKey: 'serialNo', targetKey: 'streamid', as: 'gbNvr' }); + GbCamera.hasMany(Nvr, { foreignKey: 'serialNo', sourceKey: 'streamid', as: 'gbNvr' }); + + Camera.belongsTo(GbCamera, { foreignKey: 'gbId', targetKey: 'id' }); + GbCamera.hasMany(Camera, { foreignKey: 'gbId', sourceKey: 'id' }); + + Camera.belongsTo(SecretYingshi, { foreignKey: 'yingshiSecretId', targetKey: 'id' }); + SecretYingshi.hasMany(Camera, { foreignKey: 'yingshiSecretId', sourceKey: 'id' }); + + Camera.belongsTo(Vender, { foreignKey: 'venderId', targetKey: 'id' }); + Vender.hasMany(Camera, { foreignKey: 'venderId', sourceKey: 'id' }); + + Nvr.belongsTo(Vender, { foreignKey: 'venderId', targetKey: 'id' }); + Vender.hasMany(Nvr, { foreignKey: 'venderId', sourceKey: 'id' }); + + CameraStatusResolve.belongsTo(CameraStatus, { foreignKey: 'statusId', targetKey: 'id' }); + CameraStatus.hasMany(CameraStatusResolve, { foreignKey: 'statusId', sourceKey: 'id' }); + + CameraStatusLog.belongsTo(CameraStatus, { foreignKey: 'statusId', targetKey: 'id' }); + CameraStatus.hasMany(CameraStatusLog, { foreignKey: 'statusId', sourceKey: 'id' }); }; diff --git a/code/VideoAccess-VCMP/api/app/lib/models/ax_project.js b/code/VideoAccess-VCMP/api/app/lib/models/ax_project.js index b8e8844..b060ff5 100644 --- a/code/VideoAccess-VCMP/api/app/lib/models/ax_project.js +++ b/code/VideoAccess-VCMP/api/app/lib/models/ax_project.js @@ -30,11 +30,6 @@ module.exports = dc => { indexes: [] }); - const Nvr = dc.models.Nvr; - - // Nvr.belongsTo(User, { foreignKey: 'userId', targetKey: 'id' }); - // User.hasMany(Nvr, { foreignKey: 'userId', sourceKey: 'id' }); - dc.models.AxProject = AxProject; return AxProject; }; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/app/lib/models/camera.js b/code/VideoAccess-VCMP/api/app/lib/models/camera.js index 92fba1e..57a1a5e 100644 --- a/code/VideoAccess-VCMP/api/app/lib/models/camera.js +++ b/code/VideoAccess-VCMP/api/app/lib/models/camera.js @@ -272,13 +272,5 @@ module.exports = dc => { }); dc.models.Camera = Camera; - const CameraKind = dc.models.CameraKind; - Camera.belongsTo(CameraKind, { foreignKey: 'kindId', targetKey: 'id' }); - CameraKind.hasMany(Camera, { foreignKey: 'kindId', sourceKey: 'id' }); - - const Nvr = dc.models.Nvr; - Camera.belongsTo(Nvr, { foreignKey: 'nvrId', targetKey: 'id' }); - Nvr.hasMany(Camera, { foreignKey: 'nvrId', sourceKey: 'id' }); - return Camera; }; \ 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 index e8f46be..9bc8ac6 100644 --- a/code/VideoAccess-VCMP/api/app/lib/models/camera_ability_bind.js +++ b/code/VideoAccess-VCMP/api/app/lib/models/camera_ability_bind.js @@ -48,9 +48,5 @@ module.exports = dc => { }); 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/camera_remark.js b/code/VideoAccess-VCMP/api/app/lib/models/camera_remark.js index 7c3a994..c5fbb2e 100644 --- a/code/VideoAccess-VCMP/api/app/lib/models/camera_remark.js +++ b/code/VideoAccess-VCMP/api/app/lib/models/camera_remark.js @@ -44,9 +44,5 @@ module.exports = dc => { }); dc.models.CameraRemark = CameraRemark; - const Camera = dc.models.Camera; - CameraRemark.belongsTo(Camera, { foreignKey: 'cameraId', targetKey: 'id' }); - Camera.hasMany(CameraRemark, { foreignKey: 'cameraId', sourceKey: 'id' }); - return CameraRemark; }; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/app/lib/models/camera_status.js b/code/VideoAccess-VCMP/api/app/lib/models/camera_status.js new file mode 100644 index 0000000..17de45b --- /dev/null +++ b/code/VideoAccess-VCMP/api/app/lib/models/camera_status.js @@ -0,0 +1,79 @@ +/* eslint-disable*/ +'use strict'; + +module.exports = dc => { + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const CameraStatus = sequelize.define("cameraStatus", { + id: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: true, + field: "id", + autoIncrement: true, + unique: "camera_status_id_uindex" + }, + platform: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: "平台分类 yingshi gb", + primaryKey: false, + field: "platform", + autoIncrement: false + }, + status: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "status", + autoIncrement: false + }, + describe: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "错误描述", + primaryKey: false, + field: "describe", + autoIncrement: false + }, + paraphrase: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "释义", + primaryKey: false, + field: "paraphrase", + autoIncrement: false + }, + forbidden: { + type: DataTypes.BOOLEAN, + allowNull: false, + defaultValue: null, + comment: "是否禁用", + primaryKey: false, + field: "forbidden", + autoIncrement: false + }, + paraphraseCustom: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "自定义释义", + primaryKey: false, + field: "paraphrase_custom", + autoIncrement: false + } + }, { + tableName: "camera_status", + comment: "", + indexes: [] + }); + dc.models.CameraStatus = CameraStatus; + return CameraStatus; +}; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/app/lib/models/camera_status_log.js b/code/VideoAccess-VCMP/api/app/lib/models/camera_status_log.js new file mode 100644 index 0000000..1223e4a --- /dev/null +++ b/code/VideoAccess-VCMP/api/app/lib/models/camera_status_log.js @@ -0,0 +1,47 @@ +/* eslint-disable*/ +'use strict'; + +module.exports = dc => { + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const CameraStatusLog = sequelize.define("cameraStatusLog", { + id: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: true, + field: "id", + autoIncrement: true, + unique: "camera_status_log_id_uindex_2" + }, + statusId: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "status_id", + autoIncrement: false, + references: { + key: "id", + model: "cameraStatus" + } + }, + time: { + type: DataTypes.DATE, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "time", + autoIncrement: false + } + }, { + tableName: "camera_status_log", + comment: "", + indexes: [] + }); + dc.models.CameraStatusLog = CameraStatusLog; + return CameraStatusLog; +}; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/app/lib/models/camera_status_push_config.js b/code/VideoAccess-VCMP/api/app/lib/models/camera_status_push_config.js new file mode 100644 index 0000000..da64099 --- /dev/null +++ b/code/VideoAccess-VCMP/api/app/lib/models/camera_status_push_config.js @@ -0,0 +1,79 @@ +/* eslint-disable*/ +'use strict'; + +module.exports = dc => { + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const CameraStatusPushConfig = sequelize.define("cameraStatusPushConfig", { + id: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: true, + field: "id", + autoIncrement: true, + unique: "camera_online_status_push_config_id_uindex" + }, + name: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "name", + autoIncrement: false + }, + pushWay: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: "推送方式 email / phone", + primaryKey: false, + field: "push_way", + autoIncrement: false + }, + noticeWay: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: "通知方式 offline / online / timing", + primaryKey: false, + field: "notice_way", + autoIncrement: false + }, + createUser: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "create_user", + autoIncrement: false + }, + forbidden: { + type: DataTypes.BOOLEAN, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "forbidden", + autoIncrement: false + }, + timing: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "定时推送时间", + primaryKey: false, + field: "timing", + autoIncrement: false + } + }, { + tableName: "camera_status_push_config", + comment: "", + indexes: [] + }); + dc.models.CameraStatusPushConfig = CameraStatusPushConfig; + return CameraStatusPushConfig; +}; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/app/lib/models/camera_status_push_log.js b/code/VideoAccess-VCMP/api/app/lib/models/camera_status_push_log.js new file mode 100644 index 0000000..10ff326 --- /dev/null +++ b/code/VideoAccess-VCMP/api/app/lib/models/camera_status_push_log.js @@ -0,0 +1,61 @@ +/* eslint-disable*/ +'use strict'; + +module.exports = dc => { + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const CameraStatusPushLog = sequelize.define("cameraStatusPushLog", { + id: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: true, + field: "id", + autoIncrement: true, + unique: "camera_status_push_log_id_uindex" + }, + pushConfigId: { + type: DataTypes.INTEGER, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "push_config_id", + autoIncrement: false + }, + receiver: { + type: DataTypes.JSONB, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "receiver", + autoIncrement: false + }, + time: { + type: DataTypes.DATE, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "time", + autoIncrement: false + }, + pushWay: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "push_way", + autoIncrement: false + } + }, { + tableName: "camera_status_push_log", + comment: "", + indexes: [] + }); + dc.models.CameraStatusPushLog = CameraStatusPushLog; + return CameraStatusPushLog; +}; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/app/lib/models/camera_status_push_monitor.js b/code/VideoAccess-VCMP/api/app/lib/models/camera_status_push_monitor.js new file mode 100644 index 0000000..ab9eeef --- /dev/null +++ b/code/VideoAccess-VCMP/api/app/lib/models/camera_status_push_monitor.js @@ -0,0 +1,51 @@ +/* eslint-disable*/ +'use strict'; + +module.exports = dc => { + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const CameraStatusPushMonitor = sequelize.define("cameraStatusPushMonitor", { + id: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: true, + field: "id", + autoIncrement: true, + unique: "camera_status_push_monitor_id_uindex" + }, + configId: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "config_id", + autoIncrement: false, + references: { + key: "id", + model: "cameraStatusPushConfig" + } + }, + cameraId: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "camera_id", + autoIncrement: false, + references: { + key: "id", + model: "camera" + } + } + }, { + tableName: "camera_status_push_monitor", + comment: "", + indexes: [] + }); + dc.models.CameraStatusPushMonitor = CameraStatusPushMonitor; + return CameraStatusPushMonitor; +}; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/app/lib/models/camera_status_push_receiver.js b/code/VideoAccess-VCMP/api/app/lib/models/camera_status_push_receiver.js new file mode 100644 index 0000000..48d68ce --- /dev/null +++ b/code/VideoAccess-VCMP/api/app/lib/models/camera_status_push_receiver.js @@ -0,0 +1,47 @@ +/* eslint-disable*/ +'use strict'; + +module.exports = dc => { + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const CameraStatusPushReceiver = sequelize.define("cameraStatusPushReceiver", { + id: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: true, + field: "id", + autoIncrement: true, + unique: "camera_status_push_receiver_id_uindex" + }, + configId: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "config_id", + autoIncrement: false, + references: { + key: "id", + model: "cameraStatusPushConfig" + } + }, + receiver: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: "接受者信息 邮箱或者电话号码", + primaryKey: false, + field: "receiver", + autoIncrement: false + } + }, { + tableName: "camera_status_push_receiver", + comment: "", + indexes: [] + }); + dc.models.CameraStatusPushReceiver = CameraStatusPushReceiver; + return CameraStatusPushReceiver; +}; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/app/lib/models/camera_status_resolve.js b/code/VideoAccess-VCMP/api/app/lib/models/camera_status_resolve.js new file mode 100644 index 0000000..8b42b19 --- /dev/null +++ b/code/VideoAccess-VCMP/api/app/lib/models/camera_status_resolve.js @@ -0,0 +1,47 @@ +/* eslint-disable*/ +'use strict'; + +module.exports = dc => { + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const CameraStatusResolve = sequelize.define("cameraStatusResolve", { + id: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: true, + field: "id", + autoIncrement: true, + unique: "camera_status_resolve_id_uindex" + }, + statusId: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "status_id", + autoIncrement: false, + references: { + key: "id", + model: "cameraStatus" + } + }, + resolve: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "resolve", + autoIncrement: false + } + }, { + tableName: "camera_status_resolve", + comment: "", + indexes: [] + }); + dc.models.CameraStatusResolve = CameraStatusResolve; + return CameraStatusResolve; +}; \ 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 0fa3f54..69d2fb8 100644 --- a/code/VideoAccess-VCMP/api/app/lib/models/gb_camera.js +++ b/code/VideoAccess-VCMP/api/app/lib/models/gb_camera.js @@ -156,14 +156,6 @@ module.exports = dc => { indexes: [] }); - const Nvr = dc.models.Nvr; - Nvr.belongsTo(GbCamera, { foreignKey: 'serialNo', targetKey: 'streamid', as: 'gbNvr' }); - GbCamera.hasMany(Nvr, { foreignKey: 'serialNo', sourceKey: 'streamid', as: 'gbNvr' }); - - const Camera = dc.models.Camera; - Camera.belongsTo(GbCamera, { foreignKey: 'gbId', targetKey: 'id' }); - GbCamera.hasMany(Camera, { foreignKey: 'gbId', sourceKey: 'id' }); - dc.models.GbCamera = GbCamera; return GbCamera; }; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/app/lib/models/secret_yingshi.js b/code/VideoAccess-VCMP/api/app/lib/models/secret_yingshi.js index cbc39b4..c25b319 100644 --- a/code/VideoAccess-VCMP/api/app/lib/models/secret_yingshi.js +++ b/code/VideoAccess-VCMP/api/app/lib/models/secret_yingshi.js @@ -57,10 +57,6 @@ module.exports = dc => { indexes: [] }); - const Camera = dc.models.Camera; - Camera.belongsTo(SecretYingshi, { foreignKey: 'yingshiSecretId', targetKey: 'id' }); - SecretYingshi.hasMany(Camera, { foreignKey: 'yingshiSecretId', sourceKey: 'id' }); - dc.models.SecretYingshi = SecretYingshi; return SecretYingshi; diff --git a/code/VideoAccess-VCMP/api/app/lib/models/vender.js b/code/VideoAccess-VCMP/api/app/lib/models/vender.js index d81d97c..fcdeb40 100644 --- a/code/VideoAccess-VCMP/api/app/lib/models/vender.js +++ b/code/VideoAccess-VCMP/api/app/lib/models/vender.js @@ -2,43 +2,35 @@ 'use strict'; module.exports = dc => { - const DataTypes = dc.ORM; - const sequelize = dc.orm; - const Vender = sequelize.define("vender", { - id: { - type: DataTypes.INTEGER, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: true, - field: "id", - autoIncrement: true, - unique: "vender_id_uindex" - }, - name: { - type: DataTypes.STRING, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: false, - field: "name", - autoIncrement: false - } - }, { - tableName: "vender", - comment: "", - indexes: [] - }); - - const Camera = dc.models.Camera; - Camera.belongsTo(Vender, { foreignKey: 'venderId', targetKey: 'id' }); - Vender.hasMany(Camera, { foreignKey: 'venderId', sourceKey: 'id' }); + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const Vender = sequelize.define("vender", { + id: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: true, + field: "id", + autoIncrement: true, + unique: "vender_id_uindex" + }, + name: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "name", + autoIncrement: false + } + }, { + tableName: "vender", + comment: "", + indexes: [] + }); - const Nvr = dc.models.Nvr; - Nvr.belongsTo(Vender, { foreignKey: 'venderId', targetKey: 'id' }); - Vender.hasMany(Nvr, { foreignKey: 'venderId', sourceKey: 'id' }); + dc.models.Vender = Vender; - dc.models.Vender = Vender; - - return Vender; + return Vender; }; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/app/lib/routes/status/index.js b/code/VideoAccess-VCMP/api/app/lib/routes/status/index.js new file mode 100644 index 0000000..61394f9 --- /dev/null +++ b/code/VideoAccess-VCMP/api/app/lib/routes/status/index.js @@ -0,0 +1,44 @@ +'use strict'; + +const status = require('../../controllers/status'); +const push = require('../../controllers/status/push'); + +module.exports = function (app, router, opts) { + app.fs.api.logAttr['GET/status'] = { content: '获取状态码', visible: false }; + router.get('/status', status.get); + + app.fs.api.logAttr['GET/status/simple_all'] = { content: '获取全部状态码简略信息', visible: false }; + router.get('/status/simple_all', status.getSimpleAll); + + app.fs.api.logAttr['PUT/status/banned'] = { content: '禁用状态码自定义', visible: false }; + router.put('/status/banned', status.banned); + + app.fs.api.logAttr['POST/status/custom'] = { content: '自定义状态码释义', visible: false }; + router.post('/status/custom', status.paraphraseCustom); + + app.fs.api.logAttr['POST/status/resolve'] = { content: '编辑解决方案', visible: false }; + router.post('/status/resolve', status.resolveEdit); + + app.fs.api.logAttr['GET/status/check'] = { content: '查取指定状态码信息', visible: false }; + router.get('/status/check', status.statusCheck); + + // 信鸽推送 + app.fs.api.logAttr['POST/status/push'] = { content: '编辑推送配置', visible: false }; + router.post('/status/push', push.edit); + + app.fs.api.logAttr['GET/status/push'] = { content: '获取推送配置', visible: false }; + router.get('/status/push', push.get); + + app.fs.api.logAttr['PUT/status/push/banned'] = { content: '禁用推送配置', visible: false }; + router.put('/status/push/banned', push.banned); + + app.fs.api.logAttr['DEL/status/push/:pushId'] = { content: '删除推送配置', visible: false }; + router.delete('/status/push/:pushId', push.del); + + app.fs.api.logAttr['GET/status/push/:pushId/copy'] = { content: '赋值推送配置', visible: false }; + router.get('/status/push/:pushId/copy', push.copy); + + app.fs.api.logAttr['GET/status/push/:pushId/detail'] = { content: '获取推送配置详情', visible: false }; + router.get('/status/push/:pushId/detail', push.detail); + // 信鸽推送 END +}; diff --git a/code/VideoAccess-VCMP/api/app/lib/service/socket.js b/code/VideoAccess-VCMP/api/app/lib/service/socket.js index eb5cc58..184c0b9 100644 --- a/code/VideoAccess-VCMP/api/app/lib/service/socket.js +++ b/code/VideoAccess-VCMP/api/app/lib/service/socket.js @@ -21,7 +21,7 @@ module.exports = async function factory (app, opts) { // app.socket.to(roomId).emit('TEST', { someProperty: `【星域 ROOM:${roomId}】呼叫自然选择号!!!`, }) // } - // app.socket.emit('TEST', { someProperty: '【广播】呼叫青铜时代号!!!', }) + app.socket.emit('TEST', { someProperty: '【广播】呼叫青铜时代号!!!', }) // app.socket.emit('CAMERA_ONLINE', { // ipctype: 'yingshi', diff --git a/code/VideoAccess-VCMP/api/sequelize-automate.config.js b/code/VideoAccess-VCMP/api/sequelize-automate.config.js index 497337f..efc91da 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: ['camera_remark'], // 指定生成哪些表的 models,如 ['user', 'user_post'];如果为 null,则忽略改属性 + tables: ['camera_status_push_log'], // 指定生成哪些表的 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/script/.vscode/settings.json b/code/VideoAccess-VCMP/script/.vscode/settings.json new file mode 100644 index 0000000..ab3b243 --- /dev/null +++ b/code/VideoAccess-VCMP/script/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.wordWrap": "on" +} \ No newline at end of file diff --git a/code/VideoAccess-VCMP/script/1.1.1/data/1_update_status_code_data/.vscode/launch.json b/code/VideoAccess-VCMP/script/1.1.1/data/1_update_status_code_data/.vscode/launch.json new file mode 100644 index 0000000..3a3fcba --- /dev/null +++ b/code/VideoAccess-VCMP/script/1.1.1/data/1_update_status_code_data/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + // 使用 IntelliSense 了解相关属性。 + // 悬停以查看现有属性的描述。 + // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "启动程序", + "skipFiles": [ + "/**" + ], + "program": "${workspaceFolder}\\index.js" + } + ] +} \ No newline at end of file diff --git a/code/VideoAccess-VCMP/script/1.1.1/data/1_update_status_code_data/index.js b/code/VideoAccess-VCMP/script/1.1.1/data/1_update_status_code_data/index.js new file mode 100644 index 0000000..32214fe --- /dev/null +++ b/code/VideoAccess-VCMP/script/1.1.1/data/1_update_status_code_data/index.js @@ -0,0 +1,69 @@ +try { + const { Pool, Client } = require('pg') + const XLSX = require('xlsx') + const path = require('path') + + // 连接数据库 + const pool = new Pool({ + user: 'postgres', + host: '10.8.30.32', + database: 'video_access', + password: '123', + port: 5432, + }) + + const fun = async () => { + // note: we don't try/catch this because if connecting throws an exception + // we don't need to dispose of the client (it will be undefined) + const client = await pool.connect() + try { + await client.query('BEGIN') + + // 读取数据文件 + let workbook = XLSX.readFile(path.join(__dirname, '云录制错误码.xlsx')) + let firstSheetName = workbook.SheetNames[0]; + let worksheet = workbook.Sheets[firstSheetName]; + let res = XLSX.utils.sheet_to_json(worksheet); + + // console.log(res); + + for (let d of res) { + let statusRes = await client.query(`SELECT * FROM camera_status WHERE status=$1`, [d['错误码']]); + let statusRows = statusRes.rows + + if (statusRows.length) { + + } else { + console.log(`增加${d['错误码']}`); + const statusInQuery = `INSERT INTO "camera_status" (platform, status, describe, paraphrase) VALUES($1, $2, $3, $4) RETURNING id;` + const statusRows = (await client.query(statusInQuery, ['yingshi', d['错误码'], d['错误描述'], d['释义']])).rows + // console.log(statusRows); + if (d['解决方案']) { + let resolveArr = d['解决方案'].split(';'); + // await client.query(`DELETE FROM "camera_status_solution" WHERE status_id=$1`, [statusRows[0].id]); + for (let r of resolveArr) { + await client.query( + `INSERT INTO "camera_status_resolve" (status_id, resolve) VALUES($1, $2) RETURNING id;`, + [statusRows[0].id, r] + ) + } + } + } + } + + // await client.query('ROLLBACK') + await client.query('COMMIT') + console.log('执行完毕~') + } catch (e) { + await client.query('ROLLBACK') + console.log('执行错误~') + throw e + } finally { + client.release(); + } + } + + fun() +} catch (error) { + console.error(error) +} diff --git a/code/VideoAccess-VCMP/script/1.1.1/data/1_update_status_code_data/package.json b/code/VideoAccess-VCMP/script/1.1.1/data/1_update_status_code_data/package.json new file mode 100644 index 0000000..0f66f5f --- /dev/null +++ b/code/VideoAccess-VCMP/script/1.1.1/data/1_update_status_code_data/package.json @@ -0,0 +1,16 @@ +{ + "name": "appkey-generator", + "version": "1.0.0", + "description": "tool", + "main": "index.js", + "scripts": { + "test": "mocha", + "start": "set NODE_ENV=development&&node index" + }, + "author": "liu", + "license": "ISC", + "dependencies": { + "pg": "^7.18.2", + "xlsx": "^0.17.1" + } +} diff --git a/code/VideoAccess-VCMP/script/1.1.1/data/1_update_status_code_data/云录制错误码.xlsx b/code/VideoAccess-VCMP/script/1.1.1/data/1_update_status_code_data/云录制错误码.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..00c888901466968a9eae911c94f409b750103d42 GIT binary patch literal 12866 zcmaJ|1yo&2mWALhdAPf~yAxc36Wrb1-Q9x+ch}$qC%8j!hv4o5Nq7JMGd)vl!DH3k z=bSpbKK!|^b>Dt)Px>#Cd#CA!5FaShu{9X`iteI#CKQdDIg>XTrJK``|FLp{H$L)^a z)6hB)+(KAgS}Q)nGQA%!ZnAUMKHhG>fXuQ^O|4t=Zy+s~hl^mB8&7v(uxA<;man{CXZ z2;?Y2LLA2bliGbzv?t0CYf>u^42!liU)2UCJrAx}r)%u`RzumzEZ#oDt9^DDuDnfFZ@wA zUc$q~_KaQBc>uAv*l4#)9WeurECmK1t9|r+nv15uap6lE`)9d0*boT*l^xz^9FPf7mDJp3#3@BhKPqrHQ*UG)=<9H z^=5|xRI%Oh^fnpGE5y<9xV;AMx;{eW@!kIQo6rPP*a2mcC$mGAoIHbzUu_qOmK{Bb zB$mH_Bo8O=gPH!`XSN@y&Hg$SqOL0kl-Z2AYL_xa3)4ulPT%k49W4Rc6XoTTkfONN ztGkI(ws2uof3B1CF&Fj*ogLu#onaRs7O8(daPA$gj&fp&pzD*t2;WRUvs07D4)BPz zm%)Gn(dyGhzbKI!cV-n(3HDwDRY`j&gixu;z)Bl?8b9v26pGpiaSOOT&gCT#kn*k- z*j3QP{p<wVk=WiJ_sxpR1261yp#}t0^u!5D@zR z!u~R0_%%(^maI0}k%Laq=AG$1_^J&v(naICVg&WkQoz7#xoYREK8Qy&&{UT9@K|@` z^>7xE=X*?L6nUZYp$v9d^t;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;4^Ns-!bVJ(yE$2)TB&N~6$h%|A|qq~lm z$2M3|D)TTB;pvr`GVLo>U>UdkU zOR_ed+hKe1%LJ8lC`HX*P8BEdW5P%xDULUk@hAEc6Oh93Wxg0l;;q}=(&jeY>utP? zZ%k%Fz)Vuxk-8nSu@DBm$|TGX`zh6rC_w(ILt&Z8ygn|%4sW}Podthh=11ibkZ~yX z*|qMl2U6PsJss}9E4;ZFt@>6+aWw>eG`hA+Be>{UvcGcG9^24C-Fne=q0jmVE++~6 z4)E)B?6>~=&z^bh93WsI{MX-+)c>`gemnT@a?iIV=XZINl3!8$wE+Dy=$}i_o6YZ_ z7?l6E`88$!zhG~3@^^U)_E!ETasOw$KSl0u;NS7c{%-a!$@`xa{VC%9%R2CNNdG73 zza`y&n*XUp{>%L3b;HhaF`6o*PRDWBb{%q)< zE7@C|-z=H@-Rys@Yk&Ir^S%EsKYsZC{S@F&4}V^V{pF$j^(^7-9N|BgWB(sn|IFR( zb(8TQjm4i4{}f~V74gg8&Hj>R{ORD&-OS${kpGJNciR5HM!!j>f0wr&cKzMMZ^r)- pQ2%pm|0$t { const socket = io( ioUrl - // 'http://127.0.0.1:4000' + // 'http://10.8.30.7:4000' , { query: { token: token diff --git a/code/VideoAccess-VCMP/web/config.js b/code/VideoAccess-VCMP/web/config.js index 7c87607..3d28891 100644 --- a/code/VideoAccess-VCMP/web/config.js +++ b/code/VideoAccess-VCMP/web/config.js @@ -12,6 +12,7 @@ dev && console.log('\x1B[33m%s\x1b[0m', '请遵循并及时更新 readme.md, // // 启动参数 args.option(['p', 'port'], '启动端口'); args.option(['u', 'api-url'], 'webapi的URL'); +args.option('apiVcmpUrl', 'webapi的URL 外网可访问'); args.option('apiAuthUrl', 'IOT 鉴权 api'); args.option('apiAnxinyunUrl', '安心云 api'); args.option('iotAuthWeb', 'IOT 鉴权 web'); @@ -20,6 +21,7 @@ args.option('iotVideoServer', 'IOT 后端视频服务鉴权'); const flags = args.parse(process.argv); const API_URL = process.env.API_URL || flags.apiUrl; +const API_VCMP_URL = process.env.API_VCMP_URL || flags.apiVcmpUrl; const API_AUTH_URL = process.env.API_AUTH_URL || flags.apiAuthUrl; const IOT_AUTH_WEB = process.env.IOT_AUTH_WEB || flags.iotAuthWeb; const API_ANXINYUN_URL = process.env.API_ANXINYUN_URL || flags.apiAnxinyunUrl; @@ -68,7 +70,7 @@ const product = { }, { entry: require('./routes').entry, opts: { - apiUrl: API_URL, + apiUrl: API_VCMP_URL, iotAuthWeb: IOT_AUTH_WEB, iotVideoServer: IOT_VIDEO_SERVER, staticRoot: './client', diff --git a/code/VideoAccess-VCMP/web/package.json b/code/VideoAccess-VCMP/web/package.json index 56a30b1..23aa269 100644 --- a/code/VideoAccess-VCMP/web/package.json +++ b/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://10.8.30.7:4000 --apiAuthUrl http://10.8.30.7:4200 --apiAnxinyunUrl http://10.8.30.7:4100 --iotAuthWeb http://localhost:5200 --iotVideoServer http://221.230.55.27:8081", + "start-params": "node server -p 5000 -u http://10.8.30.7:4000 --apiVcmpUrl http://localhost:4000 --apiAuthUrl http://10.8.30.7:4200 --apiAnxinyunUrl http://10.8.30.7:4100 --iotAuthWeb http://localhost:5200 --iotVideoServer http://221.230.55.27:8081", "deploy": "export NODE_ENV=production&& npm run build && node server", "build-dev": "cross-env NODE_ENV=development&&webpack --config webpack.config.js", "build": "export NODE_ENV=production&&webpack --config webpack.config.prod.js"