|
@ -2,10 +2,14 @@ const schedule = require('node-schedule'); |
|
|
const moment = require('moment') |
|
|
const moment = require('moment') |
|
|
|
|
|
|
|
|
module.exports = function (app, opts) { |
|
|
module.exports = function (app, opts) { |
|
|
const freshYingshiState = schedule.scheduleJob( |
|
|
const freshYingshiState = app.fs.scheduleInit( |
|
|
// '* * 4 * * *',
|
|
|
{ |
|
|
'*/10 * * * *', |
|
|
// interval: '* * 4 * * *',
|
|
|
|
|
|
interval: '*/10 * * * *', |
|
|
|
|
|
immediate: false, |
|
|
|
|
|
}, |
|
|
async () => { |
|
|
async () => { |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
const startTime = moment() |
|
|
const startTime = moment() |
|
|
const { models } = app.fs.dc |
|
|
const { models } = app.fs.dc |
|
@ -61,38 +65,6 @@ module.exports = function (app, opts) { |
|
|
online: storageD.online, |
|
|
online: storageD.online, |
|
|
ipctype: storageD.ipctype, |
|
|
ipctype: storageD.ipctype, |
|
|
}) |
|
|
}) |
|
|
// const { connected } = app.socket.sockets
|
|
|
|
|
|
// const roomId = 'ROOM_' + Math.random() + '_' + d.deviceSerial
|
|
|
|
|
|
// let cameraName = ''
|
|
|
|
|
|
// if (connected) {
|
|
|
|
|
|
// for (let c in connected) {
|
|
|
|
|
|
// const { client: { conn: { request: { _query } } } } = connected[c]
|
|
|
|
|
|
// if (_query && _query.token) {
|
|
|
|
|
|
// let userInfo = await app.redis.hget(_query.token, 'userInfo');
|
|
|
|
|
|
// if (userInfo) {
|
|
|
|
|
|
// userInfo = JSON.parse(userInfo)
|
|
|
|
|
|
// const corCameraRes = await models.Camera.findOne({
|
|
|
|
|
|
// where: {
|
|
|
|
|
|
// gbId: existD.id,
|
|
|
|
|
|
// createUserId: userInfo.id
|
|
|
|
|
|
// }
|
|
|
|
|
|
// })
|
|
|
|
|
|
// // TODO 管理员判断
|
|
|
|
|
|
// if (corCameraRes) {
|
|
|
|
|
|
// cameraName = corCameraRes.name
|
|
|
|
|
|
// connected[c].join(roomId)
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// app.socket.to(roomId).emit('CAMERA_ONLINE', {
|
|
|
|
|
|
// ipctype: 'yingshi',
|
|
|
|
|
|
// online: storageD.online,
|
|
|
|
|
|
// gbId: existD.id,
|
|
|
|
|
|
// name: cameraName
|
|
|
|
|
|
// })
|
|
|
|
|
|
// }
|
|
|
|
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
const yingshiRes = await models.GbCamera.create(storageD) |
|
|
const yingshiRes = await models.GbCamera.create(storageD) |
|
@ -121,10 +93,13 @@ module.exports = function (app, opts) { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const freshYingshiPlayUrl = schedule.scheduleJob( |
|
|
const freshYingshiPlayUrl = app.fs.scheduleInit( |
|
|
// '0 0 4 */1 *',
|
|
|
{ |
|
|
// '*/30 * * * *',
|
|
|
// interval: '0 0 4 */1 *',
|
|
|
'0 34 5 * * *', |
|
|
// interval: '*/30 * * * *',
|
|
|
|
|
|
interval: '0 34 5 * * *', |
|
|
|
|
|
immediate: true, |
|
|
|
|
|
}, |
|
|
async () => { |
|
|
async () => { |
|
|
try { |
|
|
try { |
|
|
const { models } = app.fs.dc |
|
|
const { models } = app.fs.dc |
|
|