Modifiche ultimate: Grafica Navi , Prenota un Altro Viaggio.
This commit is contained in:
@@ -543,6 +543,8 @@ router.patch('/callfunz', authenticate, async (req, res) => {
|
||||
|
||||
username_da_sostituire = mydata.data.username_da_sostituire;
|
||||
|
||||
let myuservecchio = await User.findOne({ idapp, username: username_da_sostituire });
|
||||
|
||||
mianavedasost = await Nave.findOne({ idapp, riga: mydata.data.riga, col: mydata.data.col });
|
||||
if (!!mianavedasost) {
|
||||
|
||||
@@ -574,8 +576,9 @@ router.patch('/callfunz', authenticate, async (req, res) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (!!myuser) {
|
||||
if (!!myusernuovo) {
|
||||
if (!!mianavedasost && mianavedasost.ind_order >= 0) {
|
||||
|
||||
// Metti campo 'delete': true su ListaIngresso
|
||||
olduseringresso = await ListaIngresso.findOne({ idapp, ind_order: mianavedasost.ind_order });
|
||||
if (!!olduseringresso) {
|
||||
@@ -587,14 +590,14 @@ router.patch('/callfunz', authenticate, async (req, res) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (!!myuser) {
|
||||
if (!!myuservecchio) {
|
||||
if (mydata.data.deleteUser && !!mianavedasost && mianavedasost.ind_order > 0) {
|
||||
// Metti Deleted allo User
|
||||
fieldsvalue = {
|
||||
deleted: true
|
||||
};
|
||||
await User.findByIdAndUpdate(myuser.id, { $set: fieldsvalue });
|
||||
await telegrambot.sendMsgTelegramToTheManagers(idapp, `L\'utente ${myuser.name} ${myuser.surname} (${myuser.username}) è stato cancellato (nascosto) perchè sostituito (da ${req.user.name} ${req.user.surname} )`);
|
||||
await User.findByIdAndUpdate(myuservecchio.id, { $set: fieldsvalue });
|
||||
await telegrambot.sendMsgTelegramToTheManagers(idapp, `L\'utente ${myuservecchio.name} ${myuservecchio.surname} (${myuservecchio.username}) è stato cancellato (nascosto) perchè sostituito (da ${req.user.name} ${req.user.surname} )`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -632,27 +635,31 @@ router.patch('/callfunz', authenticate, async (req, res) => {
|
||||
if (!rec) {
|
||||
return res.status(404).send();
|
||||
} else {
|
||||
// Send Notification to the BOT
|
||||
let messaggio = tools.get__('SPOSTATO', req.user.lang);
|
||||
|
||||
if (!!navepersistente.date_start) {
|
||||
messaggio += tools.ACAPO + tools.get__('DATA_PART_NAVE', req.user.lang) + tools.getstrDateLong(navepersistente.date_gift_chat_open) + tools.ACAPO;
|
||||
}
|
||||
if (!!navepersistente.link_chat) {
|
||||
messaggio += tools.ACAPO + '👉🏻👉🏻 <strong><a href="' + navepersistente.link_chat + '">' + tools.get__('ENTRA_GIFT_CHAT', req.user.lang) + '</a></strong> ' + tools.ACAPO;
|
||||
}
|
||||
|
||||
const myplacca = await Nave.getNavePos(idapp, navepersistente.riga, navepersistente.col);
|
||||
messaggio += tools.ACAPO + myplacca;
|
||||
|
||||
const mymsg = mydata.notifBot.txt + ' ' + myusernuovo.name + ' ' + myusernuovo.surname + ' [da ' + dachi + ']' + tools.ACAPO + 'Inviato messaggio: ' + messaggio;
|
||||
|
||||
if (mydata.data.notifBot && !!navepersistente.link_chat) {
|
||||
// Send Notification to the BOT
|
||||
let messaggio = tools.get__('SPOSTATO', req.user.lang);
|
||||
|
||||
if (!!navepersistente.date_start) {
|
||||
messaggio += tools.ACAPO + tools.get__('DATA_PART_NAVE', req.user.lang) + tools.getstrDateLong(navepersistente.date_gift_chat_open) + tools.ACAPO;
|
||||
}
|
||||
if (!!navepersistente.link_chat) {
|
||||
messaggio += tools.ACAPO + '👉🏻👉🏻 <strong><a href="' + navepersistente.link_chat + '">' + tools.get__('ENTRA_GIFT_CHAT', req.user.lang) + '</a></strong> ' + tools.ACAPO;
|
||||
}
|
||||
|
||||
const myplacca = await Nave.getNavePos(idapp, navepersistente.riga, navepersistente.col);
|
||||
messaggio += tools.ACAPO + myplacca;
|
||||
|
||||
await telegrambot.sendMsgTelegram(idapp, myusernuovo.username, messaggio);
|
||||
|
||||
await telegrambot.sendMsgTelegramToTheManagers(idapp, mydata.notifBot.txt + ' ' + myusernuovo.name + ' ' + myusernuovo.surname + ' [da ' + dachi + ']' + tools.ACAPO + 'Inviato messaggio: ' + messaggio);
|
||||
await telegrambot.sendMsgTelegramToTheManagers(idapp, mymsg);
|
||||
await telegrambot.sendMsgTelegram(idapp, req.user.username, mydata.notifBot.txt);
|
||||
await telegrambot.sendMsgTelegram(idapp, req.user.username, myplacca);
|
||||
}
|
||||
|
||||
tools.writeManagersLog(mymsg);
|
||||
|
||||
// const nomecognomeprima = myuser.name + ' ' + myuser.surname + '(' + myuser.username + ')';
|
||||
// const nomecognomenuovo = await User.getNameSurnameByUsername(idapp,);
|
||||
|
||||
Reference in New Issue
Block a user