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 4686eae..4292e72 100644 --- a/code/VideoAccess-VCMP/api/app/lib/controllers/camera/create.js +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/camera/create.js @@ -206,7 +206,8 @@ async function createNvrCamera (ctx) { serialNo: c.streamid, name: c.name, sip: corCamera.sipip, - cloudControl: c.cloudControl + cloudControl: c.cloudControl, + gbId: c.id, }) } else { createData.push({ @@ -219,6 +220,7 @@ async function createNvrCamera (ctx) { createTime: moment().format(), createUserId: userId, forbidden: false, + gbId: c.id, }) } } else { @@ -294,6 +296,7 @@ async function createIpcCamera (ctx) { const gbCameraRes = await verifyIpcInfo({ serialNo }) storageData.sip = gbCameraRes.dataValues.sipip + storageData.gbId = gbCameraRes.dataValues.id if (handleCameraId) { await models.Camera.update(storageData, { @@ -436,7 +439,8 @@ async function createCascadeCamera (ctx) { externalDomain, cascadeType, sip: c.sipip, - name: c.name + name: c.name, + gbId: c.id, } const added = addedCmeraRes.find(ac => ac.serialNo == c.streamid) if (added) { 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 5b50a48..188b10c 100644 --- a/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/camera/index.js @@ -27,6 +27,9 @@ async function getCameraProject (ctx, next) { } : {}, required: Boolean(nvrId), attributes: ['id', 'name', 'serialNo'] + }, { + model: models.GbCamera, + attributes: ['id', 'online'] }], distinct: true } diff --git a/code/VideoAccess-VCMP/api/app/lib/models/camera.js b/code/VideoAccess-VCMP/api/app/lib/models/camera.js index 6912d71..0168a47 100644 --- a/code/VideoAccess-VCMP/api/app/lib/models/camera.js +++ b/code/VideoAccess-VCMP/api/app/lib/models/camera.js @@ -246,7 +246,16 @@ module.exports = dc => { key: "id", model: "secretYingshi" } - } + }, + gbId: { + type: DataTypes.INTEGER, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "gb_id", + autoIncrement: false, + }, }, { tableName: "camera", comment: "", 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 a2403b4..d85e6c2 100644 --- a/code/VideoAccess-VCMP/api/app/lib/models/gb_camera.js +++ b/code/VideoAccess-VCMP/api/app/lib/models/gb_camera.js @@ -146,11 +146,15 @@ module.exports = dc => { 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' }); + 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/jenkinsfile b/jenkinsfile_vcmp_api similarity index 81% rename from code/VideoAccess-VCMP/api/jenkinsfile rename to jenkinsfile_vcmp_api index c246721..64ddd10 100644 --- a/code/VideoAccess-VCMP/api/jenkinsfile +++ b/jenkinsfile_vcmp_api @@ -8,10 +8,10 @@ pipeline { stages { stage('Testing vcmp ......') { steps { - sh 'switch-auth.sh vcmp' + sh 'switch-auth.sh anxinyun' buildName "#${BUILD_NUMBER} ~/fs-cloud/${JOB_NAME}:${IMAGE_VERSION}" buildDescription "registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION}" - sh 'docker build -t registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION} .' + sh 'docker build -t registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION} ./code/VideoAccess-VCMP/api' sh 'docker push registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION}' } } diff --git a/code/VideoAccess-VCMP/web/jenkinsfile b/jenkinsfile_vcmp_web similarity index 81% rename from code/VideoAccess-VCMP/web/jenkinsfile rename to jenkinsfile_vcmp_web index c246721..b92693f 100644 --- a/code/VideoAccess-VCMP/web/jenkinsfile +++ b/jenkinsfile_vcmp_web @@ -8,10 +8,10 @@ pipeline { stages { stage('Testing vcmp ......') { steps { - sh 'switch-auth.sh vcmp' + sh 'switch-auth.sh anxinyun' buildName "#${BUILD_NUMBER} ~/fs-cloud/${JOB_NAME}:${IMAGE_VERSION}" buildDescription "registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION}" - sh 'docker build -t registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION} .' + sh 'docker build -t registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION} ./code/VideoAccess-VCMP/web' sh 'docker push registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION}' } }