update Mo 27. Apr 15:01:01 CEST 2020
This commit is contained in:
parent
bab752f0e6
commit
c968a3ad00
@ -38,7 +38,7 @@ module.exports = function (io, sql, app_cfg, waip) {
|
|||||||
sql.db_log('WAIP', 'Einsatz ' + waip_id + ' für Wache ' + wachen_id + ' vorhanden, wird jetzt an Client gesendet.');
|
sql.db_log('WAIP', 'Einsatz ' + waip_id + ' für Wache ' + wachen_id + ' vorhanden, wird jetzt an Client gesendet.');
|
||||||
//letzten Einsatz verteilen
|
//letzten Einsatz verteilen
|
||||||
// zuvor: socket.id
|
// zuvor: socket.id
|
||||||
waip.einsatz_verteilen(waip_id, socket.id, wachen_id);
|
waip.einsatz_verteilen(waip_id, socket, wachen_id);
|
||||||
//vorhanden Rückmeldungen verteilen
|
//vorhanden Rückmeldungen verteilen
|
||||||
// zuvor: socket.id
|
// zuvor: socket.id
|
||||||
waip.rueckmeldung_verteilen_for_client(waip_id, socket, wachen_id);
|
waip.rueckmeldung_verteilen_for_client(waip_id, socket, wachen_id);
|
||||||
|
|||||||
@ -337,7 +337,7 @@ module.exports = function(db, uuidv4, turf, app_cfg) {
|
|||||||
SELECT COALESCE(MAX(reset_counter), ?) reset_counter FROM waip_user_config WHERE user_id = ?
|
SELECT COALESCE(MAX(reset_counter), ?) reset_counter FROM waip_user_config WHERE user_id = ?
|
||||||
) || ' minutes', 'localtime') ablaufzeit,
|
) || ' minutes', 'localtime') ablaufzeit,
|
||||||
e.EINSATZART, e.STICHWORT, e.SONDERSIGNAL, e.OBJEKT, e.ORT,e.ORTSTEIL, e.STRASSE,
|
e.EINSATZART, e.STICHWORT, e.SONDERSIGNAL, e.OBJEKT, e.ORT,e.ORTSTEIL, e.STRASSE,
|
||||||
e.BESONDERHEITEN, e.wgs84_x, e.wgs84_y, em1.EM_ALARMIERT, em0.EM_WEITERE
|
e.BESONDERHEITEN, e.wgs84_x, e.wgs84_y, e.wgs84_area, em1.EM_ALARMIERT, em0.EM_WEITERE
|
||||||
FROM WAIP_EINSAETZE e
|
FROM WAIP_EINSAETZE e
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT waip_einsaetze_id, \'[\' || group_concat(\'{\"name\": \"\' || einsatzmittel || \'\", \"zeit\": \"\' || zeitstempel || \'\"}\') || \']\' AS em_alarmiert
|
SELECT waip_einsaetze_id, \'[\' || group_concat(\'{\"name\": \"\' || einsatzmittel || \'\", \"zeit\": \"\' || zeitstempel || \'\"}\') || \']\' AS em_alarmiert
|
||||||
@ -508,9 +508,9 @@ module.exports = function(db, uuidv4, turf, app_cfg) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function db_check_permission(user, waip_id, callback) {
|
function db_check_permission(user_obj, waip_id, callback) {
|
||||||
if (user && user.permissions) {
|
if (user_obj && user_obj.permissions) {
|
||||||
if (user.permissions == 'admin') {
|
if (user_obj.permissions == 'admin') {
|
||||||
callback && callback(true);
|
callback && callback(true);
|
||||||
} else {
|
} else {
|
||||||
//permissions -> 52,62,6690,....
|
//permissions -> 52,62,6690,....
|
||||||
@ -518,7 +518,7 @@ module.exports = function(db, uuidv4, turf, app_cfg) {
|
|||||||
left join waip_wachen wa on wa.id = em.waip_wachen_ID
|
left join waip_wachen wa on wa.id = em.waip_wachen_ID
|
||||||
where waip_einsaetze_ID = ?`, [waip_id], function(err, row) {
|
where waip_einsaetze_ID = ?`, [waip_id], function(err, row) {
|
||||||
if (err == null && row) {
|
if (err == null && row) {
|
||||||
var permission_arr = user.permissions.split(",");
|
var permission_arr = user_obj.permissions.split(",");
|
||||||
var wachen_arr = row.wache.split(",");
|
var wachen_arr = row.wache.split(",");
|
||||||
const found = permission_arr.some(r => row.wache.search(RegExp(',' + r + '|\\b' + r)) >= 0);
|
const found = permission_arr.some(r => row.wache.search(RegExp(',' + r + '|\\b' + r)) >= 0);
|
||||||
if (found) {
|
if (found) {
|
||||||
|
|||||||
@ -18,7 +18,7 @@ module.exports = function (io, sql, tw, async, app_cfg) {
|
|||||||
//console.log(io.sockets.adapter);
|
//console.log(io.sockets.adapter);
|
||||||
if (typeof room_sockets !== 'undefined') {
|
if (typeof room_sockets !== 'undefined') {
|
||||||
//Object.keys(room_sockets.sockets).forEach(function (socketId) {
|
//Object.keys(room_sockets.sockets).forEach(function (socketId) {
|
||||||
Object.keys(room_sockets).forEach(function (socket) {
|
Object.keys(room_sockets).forEach(function (socket) {
|
||||||
einsatz_verteilen(waip_id, socket, rooms.room);
|
einsatz_verteilen(waip_id, socket, rooms.room);
|
||||||
sql.db_log('WAIP', 'Einsatz ' + waip_id + ' wird an ' + socket.id + ' (' + rooms.room + ') gesendet');
|
sql.db_log('WAIP', 'Einsatz ' + waip_id + ' wird an ' + socket.id + ' (' + rooms.room + ') gesendet');
|
||||||
});
|
});
|
||||||
@ -71,7 +71,7 @@ module.exports = function (io, sql, tw, async, app_cfg) {
|
|||||||
// io.sockets.to(socket_id).emit('io.neuerEinsatz', einsatzdaten)
|
// io.sockets.to(socket_id).emit('io.neuerEinsatz', einsatzdaten)
|
||||||
socket.emit('io.neuerEinsatz', einsatzdaten);
|
socket.emit('io.neuerEinsatz', einsatzdaten);
|
||||||
sql.db_log('WAIP', 'Einsatz ' + waip_id + ' fuer Wache ' + wachen_nr + ' an Socket ' + socket.id + ' gesendet');
|
sql.db_log('WAIP', 'Einsatz ' + waip_id + ' fuer Wache ' + wachen_nr + ' an Socket ' + socket.id + ' gesendet');
|
||||||
---> sql.db_update_client_status(io.sockets.sockets[socket_id], waip_id);
|
sql.db_update_client_status(socket, waip_id);
|
||||||
// Sound erstellen
|
// Sound erstellen
|
||||||
tts_erstellen(app_cfg, socket.id, einsatzdaten, function (tts) {
|
tts_erstellen(app_cfg, socket.id, einsatzdaten, function (tts) {
|
||||||
if (tts) {
|
if (tts) {
|
||||||
@ -86,8 +86,8 @@ module.exports = function (io, sql, tw, async, app_cfg) {
|
|||||||
// Standby senden
|
// Standby senden
|
||||||
//io.sockets.to(socket_id).emit('io.standby', null);
|
//io.sockets.to(socket_id).emit('io.standby', null);
|
||||||
socket.emit('io.standby', null);
|
socket.emit('io.standby', null);
|
||||||
sql.db_log('WAIP', 'Kein Einsatz fuer Wache ' + wachen_nr + ' vorhanden, Standby an Socket ' + socket_id + ' gesendet..');
|
sql.db_log('WAIP', 'Kein Einsatz fuer Wache ' + wachen_nr + ' vorhanden, Standby an Socket ' + socket.id + ' gesendet..');
|
||||||
sql.db_update_client_status(io.sockets.sockets[socket_id], null);
|
sql.db_update_client_status(socket, null);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -245,10 +245,11 @@ module.exports = function (io, sql, tw, async, app_cfg) {
|
|||||||
sql.db_get_sockets_to_standby(function (socket_ids) {
|
sql.db_get_sockets_to_standby(function (socket_ids) {
|
||||||
if (socket_ids) {
|
if (socket_ids) {
|
||||||
socket_ids.forEach(function (row) {
|
socket_ids.forEach(function (row) {
|
||||||
io.sockets.to(row.socket_id).emit('io.standby', null);
|
var socket = io.sockets.sockets[row.socket_id];
|
||||||
io.sockets.to(row.socket_id).emit('io.stopaudio', null);
|
socket.emit('io.standby', null);
|
||||||
sql.db_log('WAIP', 'Standby an Socket ' + row.socket_id + ' gesendet');
|
socket.emit('io.stopaudio', null);
|
||||||
sql.db_update_client_status(io.sockets.sockets[row.socket_id], null);
|
sql.db_log('WAIP', 'Standby an Socket ' + socket.id + ' gesendet');
|
||||||
|
sql.db_update_client_status(socket, null);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@ -263,15 +264,15 @@ module.exports = function (io, sql, tw, async, app_cfg) {
|
|||||||
// fuer jede Wache(row.room) die verbundenen Sockets(Clients) ermitteln und Standby senden
|
// fuer jede Wache(row.room) die verbundenen Sockets(Clients) ermitteln und Standby senden
|
||||||
var room_stockets = io.sockets.adapter.rooms[row.room];
|
var room_stockets = io.sockets.adapter.rooms[row.room];
|
||||||
if (typeof room_stockets !== 'undefined') {
|
if (typeof room_stockets !== 'undefined') {
|
||||||
Object.keys(room_stockets.sockets).forEach(function (socketId) {
|
Object.keys(room_stockets).forEach(function (socket) {
|
||||||
// Standby senden
|
// Standby senden
|
||||||
// TODO: Standby nur senden, wenn kein anderer (als der zu löschende) Einsatz angezeigt wird
|
// TODO: Standby nur senden, wenn kein anderer (als der zu löschende) Einsatz angezeigt wird
|
||||||
sql.db_check_client_waipid(socketId, waip_id, function (same_id) {
|
sql.db_check_client_waipid(socket.id, waip_id, function (same_id) {
|
||||||
if (same_id) {
|
if (same_id) {
|
||||||
io.sockets.to(socketId).emit('io.standby', null);
|
socket.emit('io.standby', null);
|
||||||
io.sockets.to(socketId).emit('io.stopaudio', null);
|
socket.emit('io.stopaudio', null);
|
||||||
sql.db_log('WAIP', 'Standby an Socket ' + socketId + ' gesendet');
|
sql.db_log('WAIP', 'Standby an Socket ' + socket.id + ' gesendet');
|
||||||
sql.db_update_client_status(io.sockets.sockets[socketId], null);
|
sql.db_update_client_status(socket, null);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user