- Nuovi Passi da completare: Leggere le Linee Guida e accettare le condizioni

- Aggiunti i Video e confermare di averli visti
 - In "La tua Lavagna" sono stati aggiunti come requisiti: (Accetto le Linee Guida e Vedo il Video di AYNI)
 - Aggiunto bottone "Invita Persone": apre la pagina dove c'è il messaggio da inviare alle persone.
 - La nuova pagina di registrazione https://test.gifteconomy.app/signup/paoloar77, comprende ora il testo delle Linee Guida + i Video, ed in fondo i campi per registrarsi.
This commit is contained in:
Paolo Arena
2020-02-07 22:08:46 +01:00
parent a8bec7686a
commit eccb5bbb57
20 changed files with 403 additions and 135 deletions

View File

@@ -2,8 +2,8 @@ p Benvenuto #{name} nel portale di #{nomeapp}!
p I tuoi dati di accesso da ricordare sono: p I tuoi dati di accesso da ricordare sono:
span Username:  span Username: 
strong #{username}<br> strong #{username}<br>
span Password :&nbsp; (** non mostrata per privacy **)<br> span hai dimenticato la Password? :&nbsp;
strong <a href=#{forgetpwd} target="_blank">Trovala qui</a><br>
span Email:&nbsp; span Email:&nbsp;
strong #{emailto}<br> strong #{emailto}<br>
p Per confermare la registrazione clicca sul bottone: p Per confermare la registrazione clicca sul bottone:

View File

@@ -1,13 +0,0 @@
Benvenuto #{name} nel portale di #{nomeapp}!
I tuoi dati di accesso da ricordare sono:
Username: #{username}
hai dimenticato la Password?
Trovala qui: #{forgetpwd}
Email #{emailto}
Per confermare la registrazione clicca su questo link:
#{strlinkreg}
Potrai cosi' accedere al sito digitando i tuoi dati di accesso.

View File

@@ -0,0 +1,39 @@
p Welcome #{name} to the portal #{nomeapp}!
p Your access data to remember are:
span Username:&nbsp;
strong #{username}<br>
span Forgot your Password? :&nbsp;
strong <a href=#{forgetpwd} target="_blank">Find it here</a><br>
span Email:&nbsp;
strong #{emailto}<br>
p To confirm the registration click on the button:
div.divbtn <a href=#{strlinkreg} target="_blank">
button.btn.btn-lg Verify Registration</a>
p You can then access your personal area by clicking on LOGIN and filling in all the STEPS required by :&nbsp;
strong "Step by Step Guide" !<br>
style(type="text/css").
html, body {
padding: 0;
margin: 0;
}
.divbtn {
display: flex;
align-items: center;
justify-content: center;
}
.btn-lg {
padding: 5px;
margin: 5px;
font-size: 26px;
cursor: pointer;
color: white;
background: #027be3 !important;
border-radius: 28px;
}

View File

@@ -0,0 +1 @@
=`Confirm Registration to ${nomeapp}`

View File

@@ -0,0 +1,38 @@
p ¡Bienvenido #{name} al portal #{nomeapp}!
p Sus datos de acceso a recordar son:
Nombre Usuario:&nbsp;
strong #{username}<br>
span ¿Olvidaste tu contraseña? :&nbsp;
strong <a href=#{forgetpwd} target="_blank">Encuéntrelo aquí</a><br>
span Email:&nbsp;
strong #{emailto}<br>
p Para confirmar el registro haz clic en el botón:
div.divbtn <a href=#{strlinkreg} target="_blank">
button.btn.btn-lg Verificar registro</a>
p A continuación, puede acceder a su área personal haciendo clic en INICIAR SESIÓN y rellenando todos los PASOS requeridos por :&nbsp;
strong "Guía paso a paso"!<br>
style(type="text/css").
html, body {
padding: 0;
margin: 0;
}
.divbtn {
display: flex;
align-items: center;
justify-content: center;
}
.btn-lg {
padding: 5px;
margin: 5px;
font-size: 26px;
cursor: pointer;
color: white;
background: #027be3 !important;
border-radius: 28px;
}

View File

@@ -0,0 +1 @@
=`Confirmar registro a ${nomeapp}`

View File

@@ -0,0 +1,38 @@
p Benvenuto #{name} nel portale di #{nomeapp}!
p I tuoi dati di accesso da ricordare sono:
span Username:&nbsp;
strong #{username}<br>
span hai dimenticato la Password? :&nbsp;
strong <a href=#{forgetpwd} target="_blank">Trovala qui</a><br>
span Email:&nbsp;
strong #{emailto}<br>
p Per confermare la registrazione clicca sul bottone:
div.divbtn <a href=#{strlinkreg} target="_blank">
button.btn.btn-lg Verifica Registrazione</a>
p Potrai cosi' accedere alla tua area personale cliccando su LOGIN e compilando tutti i PASSI richiesti dalla :&nbsp;
strong "Guida Passo Passo" !<br>
style(type="text/css").
html, body {
padding: 0;
margin: 0;
}
.divbtn {
display: flex;
align-items: center;
justify-content: center;
}
.btn-lg {
padding: 5px;
margin: 5px;
font-size: 26px;
cursor: pointer;
color: white;
background: #027be3 !important;
border-radius: 28px;
}

View File

@@ -0,0 +1 @@
=`Confermare la Registrazione a ${nomeapp}`

View File

@@ -33,6 +33,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==', email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'', telegram_key:'',
telegram_bot_name: '', telegram_bot_name: '',
pathreg_add:'',
}, },
{ {
idapp: '2', idapp: '2',
@@ -47,6 +48,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==', email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'', telegram_key:'',
telegram_bot_name: '', telegram_bot_name: '',
pathreg_add:'',
}, },
{ {
idapp: '3', idapp: '3',
@@ -61,6 +63,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==', email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'', telegram_key:'',
telegram_bot_name: '', telegram_bot_name: '',
pathreg_add:'',
}, },
{ {
idapp: '4', idapp: '4',
@@ -75,6 +78,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==', email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'', telegram_key:'',
telegram_bot_name: '', telegram_bot_name: '',
pathreg_add:'',
}, },
{ {
idapp: '6', idapp: '6',
@@ -89,6 +93,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==', email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'', telegram_key:'',
telegram_bot_name: '', telegram_bot_name: '',
pathreg_add:'',
}, },
{ {
idapp: '7', idapp: '7',
@@ -103,6 +108,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: 'b72b121f6fb69f7c58a269f5b5110e179430cd6fa940a168c2c10b255aa75fd1ebql9yXWoH1LwANdHD7Yvw==', email_pwd: 'b72b121f6fb69f7c58a269f5b5110e179430cd6fa940a168c2c10b255aa75fd1ebql9yXWoH1LwANdHD7Yvw==',
telegram_key:'1037577457:AAGQbdIuYoB838v61ewJ0Hearx9UPpTBhMI', telegram_key:'1037577457:AAGQbdIuYoB838v61ewJ0Hearx9UPpTBhMI',
telegram_bot_name: 'notevoleaynibot', telegram_bot_name: 'notevoleaynibot',
pathreg_add:'_ayni',
}, },
{ {
idapp: '8', idapp: '8',
@@ -117,6 +123,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==', email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'', telegram_key:'',
telegram_bot_name: '', telegram_bot_name: '',
pathreg_add:'',
}, },
]; ];
} else if (process.env.NODE_ENV === 'test') { } else if (process.env.NODE_ENV === 'test') {
@@ -135,6 +142,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==', email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'', telegram_key:'',
telegram_bot_name: '', telegram_bot_name: '',
pathreg_add:'',
}, },
{ {
idapp: '2', idapp: '2',
@@ -149,6 +157,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==', email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'', telegram_key:'',
telegram_bot_name: '', telegram_bot_name: '',
pathreg_add:'',
}, },
{ {
idapp: '3', idapp: '3',
@@ -162,6 +171,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==', email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'', telegram_key:'',
telegram_bot_name: '', telegram_bot_name: '',
pathreg_add:'',
}, },
{ {
idapp: '4', idapp: '4',
@@ -175,6 +185,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==', email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'', telegram_key:'',
telegram_bot_name: '', telegram_bot_name: '',
pathreg_add:'',
}, },
{ {
idapp: '6', idapp: '6',
@@ -188,6 +199,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==', email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'', telegram_key:'',
telegram_bot_name: '', telegram_bot_name: '',
pathreg_add:'',
}, },
{ {
idapp: '7', idapp: '7',
@@ -201,6 +213,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==', email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'1011893908:AAEThZB3fVPw8P5gTCFgTEsDmY21DdbV1Cw', telegram_key:'1011893908:AAEThZB3fVPw8P5gTCFgTEsDmY21DdbV1Cw',
telegram_bot_name: 'testnotevoleaynibot', telegram_bot_name: 'testnotevoleaynibot',
pathreg_add:'_ayni',
}, },
{ {
idapp: '8', idapp: '8',
@@ -215,6 +228,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==', email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'', telegram_key:'',
telegram_bot_name: '', telegram_bot_name: '',
pathreg_add:'',
}, },
]; ];
} else { } else {
@@ -233,6 +247,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==', email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
telegram_key:'', telegram_key:'',
telegram_bot_name: '', telegram_bot_name: '',
pathreg_add:'',
}, },
{ {
idapp: '2', idapp: '2',
@@ -247,6 +262,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==', email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
telegram_key:'', telegram_key:'',
telegram_bot_name: '', telegram_bot_name: '',
pathreg_add:'',
}, },
{ {
idapp: '3', idapp: '3',
@@ -258,6 +274,7 @@ if (process.env.NODE_ENV === 'production') {
dir: '', dir: '',
email_from: 'info.pianetalibero@gmail.com', email_from: 'info.pianetalibero@gmail.com',
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==', email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
pathreg_add:'',
}, },
{ {
idapp: '4', idapp: '4',
@@ -271,6 +288,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==', email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
telegram_key:'', telegram_key:'',
telegram_bot_name: '', telegram_bot_name: '',
pathreg_add:'',
}, },
{ {
idapp: '6', idapp: '6',
@@ -284,6 +302,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==', email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
telegram_key:'', telegram_key:'',
telegram_bot_name: '', telegram_bot_name: '',
pathreg_add:'',
}, },
{ {
idapp: '7', idapp: '7',
@@ -297,6 +316,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==', email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
telegram_bot_name: 'paotestlocalebot', telegram_bot_name: 'paotestlocalebot',
telegram_key:'353996190:AAEcEbfrm_zTK6mBKf8ye9j-PXt958SDxew', telegram_key:'353996190:AAEcEbfrm_zTK6mBKf8ye9j-PXt958SDxew',
pathreg_add:'_ayni',
}, },
{ {
idapp: '8', idapp: '8',
@@ -311,6 +331,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==', email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
telegram_key:'', telegram_key:'',
telegram_bot_name: '', telegram_bot_name: '',
pathreg_add:'',
}, },
]; ];

View File

@@ -123,7 +123,7 @@ NewstosentSchema.statics.findNewsletterPending_To_Send = function (idapp) {
starting_job: true, starting_job: true,
finish_job: false, finish_job: false,
processing_job: false, processing_job: false,
lastemailsent_Job: { $gte: tools.IncDateNow(-1000 * 60 * 60 * 8) }, lastemailsent_Job: { $gte: tools.IncDateNow(-1000 * 60 * 60 * 15) },
idapp idapp
}).then((rec) => { }).then((rec) => {
// console.log('findNewsletterPending_To_Send', rec); // console.log('findNewsletterPending_To_Send', rec);

View File

@@ -172,6 +172,9 @@ const UserSchema = new mongoose.Schema({
my_dream: { my_dream: {
type: String, type: String,
}, },
saw_and_accepted: {
type: Number,
},
saw_zoom_presentation: { saw_zoom_presentation: {
type: Boolean type: Boolean
}, },
@@ -324,10 +327,10 @@ UserSchema.statics.findByUsername = function (idapp, username) {
}); });
}; };
UserSchema.statics.getUserShortDataByUsername = function (idapp, username) { UserSchema.statics.getUserShortDataByUsername = async function (idapp, username) {
const User = this; const User = this;
return User.findOne({ const myrec = await User.findOne({
'idapp': idapp, 'idapp': idapp,
'username': username, 'username': username,
}, { }, {
@@ -338,6 +341,7 @@ UserSchema.statics.getUserShortDataByUsername = function (idapp, username) {
verified_email: 1, verified_email: 1,
'profile.teleg_id': 1, 'profile.teleg_id': 1,
'profile.saw_zoom_presentation': 1, 'profile.saw_zoom_presentation': 1,
'profile.saw_and_accepted': 1,
'profile.email_paypal': 1, 'profile.email_paypal': 1,
'profile.my_dream': 1, 'profile.my_dream': 1,
'profile.paymenttypes': 1, 'profile.paymenttypes': 1,
@@ -354,11 +358,18 @@ UserSchema.statics.getUserShortDataByUsername = function (idapp, username) {
return null; return null;
} }
}); });
if (myrec) {
myrec.numinvitati = await User.getnumInvitati(idapp, myrec.username);
myrec.numinvitatiattivi = await User.getnumInvitatiAttivi(idapp, myrec.username);
}
return myrec
}; };
UserSchema.statics.getDownlineByUsername = function (idapp, username) { UserSchema.statics.getDownlineByUsername = async function (idapp, username) {
const User = this; const User = this;
return User.find({ const arrrec = await User.find({
'idapp': idapp, 'idapp': idapp,
'aportador_solidario': username, 'aportador_solidario': username,
}, { }, {
@@ -370,6 +381,7 @@ UserSchema.statics.getDownlineByUsername = function (idapp, username) {
verified_email: 1, verified_email: 1,
'profile.teleg_id': 1, 'profile.teleg_id': 1,
'profile.saw_zoom_presentation': 1, 'profile.saw_zoom_presentation': 1,
'profile.saw_and_accepted': 1,
'profile.email_paypal': 1, 'profile.email_paypal': 1,
'profile.my_dream': 1, 'profile.my_dream': 1,
'profile.paymenttypes': 1, 'profile.paymenttypes': 1,
@@ -378,13 +390,18 @@ UserSchema.statics.getDownlineByUsername = function (idapp, username) {
date_reg: 1, date_reg: 1,
img: 1 img: 1
}, (err, arrrec) => { }, (err, arrrec) => {
return arrrec;
for (const rec of arrrec) {
rec.numinvitatiattivi = User.getnumInvitatiAttivi(idapp, rec.username);
}
return arrrec
}); });
if (!!arrrec) {
for (const rec of arrrec) {
rec._doc.numinvitati = await User.getnumInvitati(idapp, rec.username);
rec._doc.numinvitatiattivi = await User.getnumInvitatiAttivi(idapp, rec.username);
}
}
return arrrec
}; };
@@ -396,6 +413,7 @@ UserSchema.statics.getnumInvitatiAttivi = function (idapp, username) {
aportador_solidario: username, aportador_solidario: username,
'profile.teleg_id': { $gt: 1 }, 'profile.teleg_id': { $gt: 1 },
'profile.saw_zoom_presentation': true, 'profile.saw_zoom_presentation': true,
'profile.saw_and_accepted': true,
}); });
}; };
@@ -602,7 +620,7 @@ UserSchema.statics.getusersManagers = async function (idapp) {
UserSchema.statics.getUsersTelegALL = async function (idapp) { UserSchema.statics.getUsersTelegALL = async function (idapp) {
const User = this; const User = this;
return await User.find({ idapp, 'profile.teleg_id': { $gt: 0 } }, { 'profile.teleg_id': 1 }) return await User.find({ idapp, 'profile.teleg_id': { $gt: 0 } }, { 'profile.teleg_id': 1, perm: 1 })
.then((arrrec) => { .then((arrrec) => {
return (!!arrrec) ? arrrec : null; return (!!arrrec) ? arrrec : null;
}).catch((e) => { }).catch((e) => {
@@ -729,7 +747,7 @@ UserSchema.statics.getDashboard = async function (idapp, aportador_solidario, us
dashboard.myself = await User.getUserShortDataByUsername(idapp, username); dashboard.myself = await User.getUserShortDataByUsername(idapp, username);
// Data of my Aportador // Data of my Aportador
dashboard.aportador = await User.getUserShortDataByUsername(idapp, aportador_solidario); dashboard.aportador = await User.getUserShortDataByUsername(idapp, aportador_solidario);
if (dashboard.aportador === undefined ) { if (dashboard.aportador === undefined) {
dashboard.aportador = await ExtraList.getUserNotRegisteredByNameSurname(idapp, aportador_solidario_nome_completo); dashboard.aportador = await ExtraList.getUserNotRegisteredByNameSurname(idapp, aportador_solidario_nome_completo);
} }
@@ -827,6 +845,14 @@ UserSchema.statics.getUsersZoom = async function (idapp) {
return await User.count(myfind); return await User.count(myfind);
}; };
UserSchema.statics.getSaw_and_Accepted = async function (idapp) {
const User = this;
const myfind = { idapp, 'profile.saw_and_accepted': shared_consts.ALL_SAW_AND_ACCEPTED };
return await User.count(myfind);
};
UserSchema.statics.getUsersDreams = async function (idapp) { UserSchema.statics.getUsersDreams = async function (idapp) {
const User = this; const User = this;

View File

@@ -279,7 +279,7 @@ router.post('/setactivate', authenticate, async (req, res) => {
locale = req.body.locale; locale = req.body.locale;
const rec = { const rec = {
activate activate,
}; };
return await Newstosent.findOneAndUpdate({ _id: id }, { $set: rec }, { new: false }).then((item) => { return await Newstosent.findOneAndUpdate({ _id: id }, { $set: rec }, { new: false }).then((item) => {

View File

@@ -30,6 +30,7 @@ router.post('/load', async (req, res) => {
num_teleg_attivo: await User.getUsersTelegramAttivo(idapp), num_teleg_attivo: await User.getUsersTelegramAttivo(idapp),
num_teleg_pending: await User.getUsersTelegramPending(idapp), num_teleg_pending: await User.getUsersTelegramPending(idapp),
num_part_zoom: await User.getUsersZoom(idapp), num_part_zoom: await User.getUsersZoom(idapp),
num_part_accepted: await User.getSaw_and_Accepted(idapp),
num_users_dream: await User.getUsersDreams(idapp), num_users_dream: await User.getUsersDreams(idapp),
arr_nations: await User.findAllDistinctNationality(idapp), arr_nations: await User.findAllDistinctNationality(idapp),
reg_daily: await User.calcRegDaily(idapp), reg_daily: await User.calcRegDaily(idapp),

View File

@@ -85,6 +85,8 @@ module.exports = {
const email = new Email(paramemail); const email = new Email(paramemail);
console.log(' *** Invia Email a ' + to);
return email return email
.send({ .send({
template: template, template: template,
@@ -148,7 +150,7 @@ module.exports = {
return strlinkreg; return strlinkreg;
}, },
getlinkRequestNewPassword: function (idapp, email, tokenforgot) { getlinkRequestNewPassword: function (idapp, email, tokenforgot) {
strlinkreg = tools.getHostByIdApp(idapp) + process.env.LINK_UPDATE_PASSWORD + `?idapp=${idapp}&email=${email}&tokenforgot=${tokenforgot}`; strlinkreg = tools.getHostByIdApp(idapp) + process.env.LINK_UPDATE_PASSWORD + `?idapp=${idapp}&email=${email}&tokenforgot=${tokenforgot}`;
return strlinkreg; return strlinkreg;
}, },
sendEmail_Registration: async function (lang, emailto, user, idapp, idreg) { sendEmail_Registration: async function (lang, emailto, user, idapp, idreg) {
@@ -164,12 +166,12 @@ module.exports = {
username: user.username, username: user.username,
name: user.name, name: user.name,
surname: user.surname, surname: user.surname,
forgetpwd: "", forgetpwd: tools.getHostByIdApp(idapp) + '/requestresetpwd',
emailto: emailto, emailto: emailto,
user, user,
}; };
this.sendEmail_base('registration/' + lang, emailto, mylocalsconf, tools.getreplyToEmailByIdApp(idapp)); this.sendEmail_base(tools.getpathregByIdApp(idapp, lang), emailto, mylocalsconf, tools.getreplyToEmailByIdApp(idapp));
// Send to the Admin an Email // Send to the Admin an Email
this.sendEmail_base('admin/registration/' + tools.LANGADMIN, tools.getAdminEmailByIdApp(idapp), mylocalsconf, ''); this.sendEmail_base('admin/registration/' + tools.LANGADMIN, tools.getAdminEmailByIdApp(idapp), mylocalsconf, '');
@@ -411,10 +413,13 @@ module.exports = {
}, },
replacefields: function (mylocalsconf) { replacefields: function (mylocalsconf) {
try {
mylocalsconf.dataemail.disclaimer_out = this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.disclaimer); mylocalsconf.dataemail.disclaimer_out = this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.disclaimer);
mylocalsconf.dataemail.disc_bottom_out = this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.disc_bottom); mylocalsconf.dataemail.disc_bottom_out = this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.disc_bottom);
mylocalsconf.dataemail.templ.testoheadermail_out = this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.templ.testoheadermail); mylocalsconf.dataemail.templ.testoheadermail_out = this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.templ.testoheadermail);
} catch (e) {
console.error('Error replacefields: ' + e)
}
return mylocalsconf return mylocalsconf
}, },
@@ -445,7 +450,7 @@ module.exports = {
}; };
// console.log(mydata.templemail_id); // console.log(mydata.templemail_id);
mydata.templ = await TemplEmail.findOne({_id: mydata.templemail_id }); mydata.templ = await TemplEmail.findOne({ _id: mydata.templemail_id });
// console.log(mydata.templ); // console.log(mydata.templ);
return mydata return mydata
@@ -487,7 +492,10 @@ module.exports = {
sendEmail_Newsletter_Events: async function (lang, idapp, id_newstosent) { sendEmail_Newsletter_Events: async function (lang, idapp, id_newstosent) {
console.log('INIZIO - sendEmail_Newsletter_Events', tools.getNomeAppByIdApp(idapp)); const msginizio = 'INIZIO - sendEmail_Newsletter_Events: ' + tools.getNomeAppByIdApp(idapp);
console.log(msginizio);
telegrambot.sendMsgTelegramToTheManagers(idapp, msginizio);
//++Todo Extract List Email to send //++Todo Extract List Email to send
const userstosend = await MailingList.findAllIdAppSubscribed(idapp); const userstosend = await MailingList.findAllIdAppSubscribed(idapp);
@@ -507,76 +515,108 @@ module.exports = {
const mynewsrec = await Newstosent.findOne({ _id: id_newstosent }); const mynewsrec = await Newstosent.findOne({ _id: id_newstosent });
mynewsrec.numemail_tot = userstosend.length; try {
mynewsrec.templemail_str = mylocalsconf.dataemail.templ.subject; mynewsrec.numemail_tot = userstosend.length;
mynewsrec.numemail_sent = await MailingList.getnumSent(idapp, id_newstosent); mynewsrec.templemail_str = mylocalsconf.dataemail.templ.subject;
mynewsrec.numemail_sent = await MailingList.getnumSent(idapp, id_newstosent);
const smtpTransport = this.getTransport(mylocalsconf); const smtpTransport = this.getTransport(mylocalsconf);
// LOOP USERS EMAIL // LOOP USERS EMAIL
for (const user of userstosend) { for (const user of userstosend) {
const isok = await MailingList.isOk(idapp, user._id, id_newstosent); try {
if (isok) {
let secpause = await Settings.getValDbSettings(idapp, 'MSEC_PAUSE_SEND', process.env.DELAY_SENDEMAIL);
if (secpause < process.env.DELAY_SENDEMAIL)
secpause = process.env.DELAY_SENDEMAIL;
activate = await Newstosent.isActivated(id_newstosent); const isok = await MailingList.isOk(idapp, user._id, id_newstosent);
if (isok) {
let secpause = await Settings.getValDbSettings(idapp, 'MSEC_PAUSE_SEND', process.env.DELAY_SENDEMAIL);
if (secpause < process.env.DELAY_SENDEMAIL)
secpause = process.env.DELAY_SENDEMAIL;
if (!activate) { activate = await Newstosent.isActivated(id_newstosent);
// Invio Newsletter Abortito!
mynewsrec.error_job = 'Invio Newsletter abortito alle ore ' + new Date().toDateString() + new Date().toTimeString(); if (!activate) {
await mynewsrec.save(); // Invio Newsletter Abortito!
await Newstosent.processingJob(id_newstosent, false); mynewsrec.error_job = 'Invio Newsletter abortito alle ore ' + new Date().toDateString() + new Date().toTimeString();
console.log('*** L\'Invio della Newsletter è stato fermato ! '); telegrambot.sendMsgTelegramToTheManagers(idapp, mynewsrec.error_job);
return false await mynewsrec.save();
await Newstosent.processingJob(id_newstosent, false);
console.log('*** L\'Invio della Newsletter è stato fermato ! ');
return false
}
mylocalsconf.name = user.name;
mylocalsconf.surname = user.surname;
mylocalsconf.emailto = user.email;
mylocalsconf.hashemail = tools.getHash(user.email);
mylocalsconf = this.replacefields(mylocalsconf);
// If has already sent, don't send it again!
if (user.lastid_newstosent !== id_newstosent.toString()) {
// console.log('@@@@@ COMPARE DIVERSI: lastid', user.lastid_newstosent, 'idsent', id_newstosent.toString());
if (process.env.DEBUG)
await tools.snooze(5000);
// Send Email to the User
// console.log('-> Invio Email (', mynewsrec.numemail_sent, '/', mynewsrec.numemail_tot, ')');
const esito = this.sendEmail_base('newsletter/' + lang, mylocalsconf.emailto, mylocalsconf, mylocalsconf.dataemail.email_reply, smtpTransport);
if ((mynewsrec.numemail_sent % 50) === 0) {
const msgproc = 'In Corso ' + mynewsrec.numemail_sent + ' / ' + mynewsrec.numemail_tot + ' Email inviate...';
telegrambot.sendMsgTelegramToTheManagers(idapp, msgproc);
}
//Put the result in the database, to check if is sent or not.
const updateml = await MailingList.findOneAndUpdate({
idapp,
email: user.email
}, { $set: { lastid_newstosent: ObjectID(id_newstosent) } }, { new: false });
//Delay for send email...
await tools.snooze(secpause);
mynewsrec.lastemailsent_Job = new Date();
mynewsrec.numemail_sent = await MailingList.getnumSent(idapp, id_newstosent);
const recsaved = await mynewsrec.save();
} else {
console.log('*** COMPARE: UGUALI !!!!! lastid', user.lastid_newstosent, 'idsent', id_newstosent.toString());
}
}
} catch (e) {
const msgerr = 'Error LOOP sendEmail_Newsletter_Events: ' + e;
console.error(msgerr);
telegrambot.sendMsgTelegramToTheManagers(idapp, msgerr);
} }
}
mylocalsconf.name = user.name; await Newstosent.endJob(id_newstosent);
mylocalsconf.surname = user.surname; await Newstosent.processingJob(id_newstosent, false);
mylocalsconf.emailto = user.email; let msgfine = 'FINE - sendEmail_Newsletter_Events [' + tools.getNomeAppByIdApp(idapp) + ']: ';
mylocalsconf.hashemail = tools.getHash(user.email); msgfine += mynewsrec.numemail_sent + ' Email inviate';
console.log(msgfine);
mylocalsconf = this.replacefields(mylocalsconf); telegrambot.sendMsgTelegramToTheManagers(idapp, msgfine);
} catch (e) {
// If has already sent, don't send it again! activate = await Newstosent.isActivated(id_newstosent);
if (user.lastid_newstosent !== id_newstosent.toString()) {
console.log('@@@@@ COMPARE DIVERSI: lastid', user.lastid_newstosent, 'idsent', id_newstosent.toString());
if (process.env.DEBUG) if (!activate) {
await tools.snooze(5000); // Invio Newsletter Abortito!
mynewsrec.error_job = 'Invio Newsletter abortito alle ore ' + new Date().toDateString() + new Date().toTimeString();
// Send Email to the User telegrambot.sendMsgTelegramToTheManagers(idapp, mynewsrec.error_job);
// console.log('-> Invio Email (', mynewsrec.numemail_sent, '/', mynewsrec.numemail_tot, ')'); await mynewsrec.save();
const esito = this.sendEmail_base('newsletter/' + lang, mylocalsconf.emailto, mylocalsconf, mylocalsconf.dataemail.email_reply, smtpTransport); await Newstosent.processingJob(id_newstosent, false);
console.log('*** L\'Invio della Newsletter è stato fermato ! ');
//Put the result in the database, to check if is sent or not. return false
const updateml = await MailingList.findOneAndUpdate({
idapp,
email: user.email
}, { $set: { lastid_newstosent: ObjectID(id_newstosent) } }, { new: false });
//Delay for send email...
await tools.snooze(secpause);
mynewsrec.lastemailsent_Job = new Date();
mynewsrec.numemail_sent = await MailingList.getnumSent(idapp, id_newstosent);
const recsaved = await mynewsrec.save();
} else {
console.log('*** COMPARE: UGUALI !!!!! lastid', user.lastid_newstosent, 'idsent', id_newstosent.toString());
}
} }
} }
await Newstosent.endJob(id_newstosent);
await Newstosent.processingJob(id_newstosent, false);
console.log('****', tools.getNomeAppByIdApp(idapp), mynewsrec.numemail_sent, 'Email inviate');
console.log('FINE (esco da funz) - sendEmail_Newsletter_Events', tools.getNomeAppByIdApp(idapp));
}, },
@@ -597,11 +637,11 @@ module.exports = {
return Newstosent.findNewsletterPending_To_Send(idapp) return Newstosent.findNewsletterPending_To_Send(idapp)
.then((rec) => { // .then((rec) => { //
this.sendNewsletter(rec) this.sendNewsletter(rec, idapp)
}); });
}, },
sendNewsletter: async function (rec) { sendNewsletter: async function (rec, idapp) {
if (rec) { if (rec) {
// Start the job // Start the job
myjobnews = await Newstosent.findOne({ _id: rec._id }); myjobnews = await Newstosent.findOne({ _id: rec._id });
@@ -612,7 +652,7 @@ module.exports = {
myjobnews.save() myjobnews.save()
.then((ris) => { .then((ris) => {
this.sendEmail_Newsletter_Events("it", '2', rec._id); this.sendEmail_Newsletter_Events("it", idapp, rec._id);
}) })
.catch((e) => { .catch((e) => {
console.error(e); console.error(e);

View File

@@ -42,6 +42,7 @@ require('./models/mypage');
require('./models/calzoom'); require('./models/calzoom');
const mysql_func = require('./mysql/mysql_func'); const mysql_func = require('./mysql/mysql_func');
const { Newstosent } = require('./models/newstosent');
const index_router = require('./router/index_router'); const index_router = require('./router/index_router');
const push_router = require('./router/push_router'); const push_router = require('./router/push_router');
@@ -183,13 +184,13 @@ if (process.env.PROD !== 1) {
// testmsgwebpush(); // testmsgwebpush();
// sendemail.testemail('2', 'it'); // sendemail.testemail('2', 'it');
/* /*
let crypt = tools.cryptdata(''); let crypt = tools.cryptdata('');
let decrypt = tools.decryptdata(crypt); let decrypt = tools.decryptdata(crypt);
console.log('crypted:', crypt); console.log('crypted:', crypt);
console.log('decrypted:', decrypt); console.log('decrypted:', decrypt);
*/ */
mycron(); mycron();
} }
@@ -228,13 +229,13 @@ function startserv() {
// Check if is Empty (new Server Data) // Check if is Empty (new Server Data)
/* /*
cfgserver.countDocuments(function (err, count) { cfgserver.countDocuments(function (err, count) {
if (!err && count === 0) { if (!err && count === 0) {
populateDBadmin(); populateDBadmin();
} }
}); });
*/ */
} }
@@ -273,6 +274,18 @@ cron.schedule('*/2 * * * *', () => {
mycron(); mycron();
}); });
async function resetProcessingJob() {
arrrec = await Newstosent.find({});
for (const rec of arrrec) {
rec.processing_job = false;
await Newstosent.findOneAndUpdate({ _id: rec.id }, { $set: rec }, { new: false }).then((item) => {
});
}
}
//app.listen(port, () => { //app.listen(port, () => {
// console.log(`Server started at port ${port}`); // console.log(`Server started at port ${port}`);
//}); //});
@@ -280,6 +293,14 @@ cron.schedule('*/2 * * * *', () => {
telegrambot.sendMsgTelegram('7', telegrambot.ADMIN_USER_SERVER, `Ciao ${telegrambot.ADMIN_USER_NAME_SERVER}!`); telegrambot.sendMsgTelegram('7', telegrambot.ADMIN_USER_SERVER, `Ciao ${telegrambot.ADMIN_USER_NAME_SERVER}!`);
telegrambot.sendMsgTelegramByIdTelegram('7', telegrambot.ADMIN_IDTELEGRAM_SERVER, `Il Server ${process.env.DATABASE} è appena ripartito!`); telegrambot.sendMsgTelegramByIdTelegram('7', telegrambot.ADMIN_IDTELEGRAM_SERVER, `Il Server ${process.env.DATABASE} è appena ripartito!`);
telegrambot.sendMsgTelegramByIdTelegram('2', telegrambot.ADMIN_IDTELEGRAM_SERVER, `Il Server ${process.env.DATABASE} è appena ripartito!`);
resetProcessingJob();
//
// telegrambot.sendMsgTelegramToTheManagers('7', 'PROVAAA!'); // telegrambot.sendMsgTelegramToTheManagers('7', 'PROVAAA!');
// if (process.env.PROD !== 1) { // if (process.env.PROD !== 1) {

View File

@@ -2,10 +2,14 @@ const tools = require('../tools/general');
const appTelegram = ['7']; const appTelegram = ['7'];
const appTelegramFinti = ['2'];
const appTelegramDest = ['7'];
const printf = require('util').format; const printf = require('util').format;
const { User } = require('../models/user'); const { User } = require('../models/user');
const { CalZoom } = require('../models/calzoom'); const { CalZoom } = require('../models/calzoom');
const shared_consts = require('../tools/shared_nodejs');
const emoji = require('node-emoji'); const emoji = require('node-emoji');
@@ -16,6 +20,9 @@ const Benvenuto = emoji.get('heartbeat') + emoji.get('heartbeat') + emoji.get('h
const emo = { const emo = {
STARS: emoji.get('stars'), STARS: emoji.get('stars'),
FIRE: emoji.get('fire'), FIRE: emoji.get('fire'),
TV: emoji.get('tv'),
NEWSPAPER: emoji.get('newspaper'),
PENCIL: emoji.get('pencil2'),
DREAM: emoji.get('beach_with_umbrella'), DREAM: emoji.get('beach_with_umbrella'),
EYES: emoji.get('eyes'), EYES: emoji.get('eyes'),
DIZZY: emoji.get('dizzy'), DIZZY: emoji.get('dizzy'),
@@ -73,6 +80,7 @@ const Menu = {
ADMIN: emoji.get('information_desk_person') + ' Admin', ADMIN: emoji.get('information_desk_person') + ' Admin',
ALTRO: emoji.get('newspaper') + ' Altro', ALTRO: emoji.get('newspaper') + ' Altro',
MSGATUTTI: emoji.get('incoming_envelope') + ' Invia a TUTTI', MSGATUTTI: emoji.get('incoming_envelope') + ' Invia a TUTTI',
MSGSTAFF: emoji.get('incoming_envelope') + ' Invia a STAFF',
INDIETRO: emoji.get('back') + ' Indietro', INDIETRO: emoji.get('back') + ' Indietro',
SI: emoji.get('thumbsup') + ' SI', SI: emoji.get('thumbsup') + ' SI',
NO: emoji.get('thumbsdown') + ' NO', NO: emoji.get('thumbsdown') + ' NO',
@@ -85,8 +93,8 @@ const MenuStandard = [[Menu.LAVAGNA, Menu.LINK_CONDIVIDERE], [Menu.ZOOM, Menu.AS
const MenuPerAdmin = [[Menu.LAVAGNA, Menu.LINK_CONDIVIDERE], [Menu.ZOOM, Menu.ASSISTENZA], [Menu.ADMIN, Menu.ALTRO]]; const MenuPerAdmin = [[Menu.LAVAGNA, Menu.LINK_CONDIVIDERE], [Menu.ZOOM, Menu.ASSISTENZA], [Menu.ADMIN, Menu.ALTRO]];
const MenuYesNo = [[Menu.SI, Menu.NO]]; const MenuYesNo = [[Menu.SI, Menu.NO]];
const MenuAdmin = [[Menu.MSGATUTTI, Menu.INDIETRO], ['', '']]; const MenuAdmin = [[Menu.MSGSTAFF, Menu.MSGATUTTI, Menu.INDIETRO], ['', '']];
const MenuYes = [[Menu.MSGATUTTI, Menu.INDIETRO], ['', '']]; const MenuYes = [[Menu.MSGSTAFF, Menu.INDIETRO], ['', '']];
const Status = { const Status = {
NONE: 0, NONE: 0,
@@ -175,9 +183,11 @@ module.exports = {
if (usersmanagers) { if (usersmanagers) {
for (const rec of usersmanagers) { for (const rec of usersmanagers) {
this.sendMsgTelegramByIdTelegram(idapp, rec.profile.teleg_id, emo.ROBOT_FACE + '[BOT-STAFF]' +emo.ADMIN + ': ' + text) this.sendMsgTelegramByIdTelegram(idapp, rec.profile.teleg_id, emo.ROBOT_FACE + '[BOT-STAFF]' + emo.ADMIN + ': ' + text)
await tools.snooze(300)
} }
} }
return true
}, },
@@ -185,9 +195,10 @@ module.exports = {
const usersall = await User.getUsersTelegALL(idapp); const usersall = await User.getUsersTelegALL(idapp);
if (usersall) { if (usersall) {
usersall.forEach((rec) => { for (const rec of usersall) {
this.sendMsgTelegramByIdTelegram(idapp, rec.profile.teleg_id, text) this.sendMsgTelegramByIdTelegram(idapp, rec.profile.teleg_id, text);
}); await tools.snooze(300)
}
} }
}, },
@@ -277,6 +288,8 @@ class Telegram {
await this.menuAdmin(msg) await this.menuAdmin(msg)
} else if (msg.text === Menu.MSGATUTTI) { } else if (msg.text === Menu.MSGATUTTI) {
await this.menumsgAll(msg) await this.menumsgAll(msg)
} else if (msg.text === Menu.MSGSTAFF) {
await this.menumsgStaff(msg)
} else if (msg.text === Menu.INDIETRO) { } else if (msg.text === Menu.INDIETRO) {
await this.msgScegliMenu(msg); await this.msgScegliMenu(msg);
} else { } else {
@@ -332,6 +345,8 @@ class Telegram {
mystr += '\n' + this.getsymb(emo.ENVELOPE, rec.user.verified_email); mystr += '\n' + this.getsymb(emo.ENVELOPE, rec.user.verified_email);
mystr += rec.user.verified_email ? tools.get__('EMAIL_VERIF', msg) : tools.get__('EMAIL_NON_VERIF', msg); mystr += rec.user.verified_email ? tools.get__('EMAIL_VERIF', msg) : tools.get__('EMAIL_NON_VERIF', msg);
mystr += '\n' + '\n' + this.getsymb(emo.PENCIL, tools.isBitActive(rec.user.profile.saw_and_accepted, shared_consts.Accepted.CHECK_READ_GUIDELINES)) + tools.get__('LINEE_GUIDA', msg);
mystr += '\n' + '\n' + this.getsymb(emo.TV, tools.isBitActive(rec.user.profile.saw_and_accepted, shared_consts.Accepted.CHECK_SEE_VIDEO_PRINCIPI)) + tools.get__('VIDEO_INTRO', msg);
mystr += '\n' + '\n' + this.getsymb(emo.EYES, rec.user.profile.saw_zoom_presentation) + tools.get__('ZOOM_PARTECIPATO', msg); mystr += '\n' + '\n' + this.getsymb(emo.EYES, rec.user.profile.saw_zoom_presentation) + tools.get__('ZOOM_PARTECIPATO', msg);
mystr += '\n' + '\n' + this.getsymb(emo.DREAM, this.isdreamset(rec.user)) + tools.get__('SCRITTO_SOGNO', msg); mystr += '\n' + '\n' + this.getsymb(emo.DREAM, this.isdreamset(rec.user)) + tools.get__('SCRITTO_SOGNO', msg);
@@ -366,7 +381,6 @@ class Telegram {
mystr += '\n' + printf(tools.get__('INFO_LAVAGNA_SITO', msg), tools.getHostByIdApp(this.idapp)); mystr += '\n' + printf(tools.get__('INFO_LAVAGNA_SITO', msg), tools.getHostByIdApp(this.idapp));
} }
if (!!mystr) if (!!mystr)
await this.sendMsg(msg.chat.id, mystr); await this.sendMsg(msg.chat.id, mystr);
@@ -436,16 +450,7 @@ class Telegram {
} }
await await this.sendMsg(msg.chat.id, mystr);
this
.sendMsg(msg
.chat
.id
,
mystr
)
;
} }
async menuAdmin(msg) { async menuAdmin(msg) {
@@ -459,6 +464,17 @@ class Telegram {
if (rec.user) { if (rec.user) {
const mystr = 'Scrivi qui un Messaggio da inviare a TUTTI:'; const mystr = 'Scrivi qui un Messaggio da inviare a TUTTI:';
rec.msgall_status = StatusMSGALL.ASK; rec.msgall_status = StatusMSGALL.ASK;
rec.msgall_staff = false;
await this.sendMsg(msg.chat.id, mystr, MenuAdmin);
}
}
async menumsgStaff(msg) {
const rec = this.getRecInMem(msg);
if (rec.user) {
const mystr = 'Scrivi qui un Messaggio da inviare allo STAFF:';
rec.msgall_status = StatusMSGALL.ASK;
rec.msgall_staff = true;
await this.sendMsg(msg.chat.id, mystr, MenuAdmin); await this.sendMsg(msg.chat.id, mystr, MenuAdmin);
} }
} }
@@ -596,7 +612,7 @@ class Telegram {
} }
} }
async sendMsgToAll(rec, msg, texttosend) { async sendMsgToAll(rec, msg, texttosend, solostaff) {
if (texttosend.length < 3) { if (texttosend.length < 3) {
} else { } else {
const usersall = await const usersall = await
@@ -606,8 +622,15 @@ class Telegram {
if (usersall) { if (usersall) {
for (const rec of usersall) { for (const rec of usersall) {
await this.sendMsg(rec.profile.teleg_id, texttosend); let invia = true;
nummsgsent++; if (solostaff) {
invia = User.isManager(rec.perm)
}
if (invia) {
await this.sendMsg(rec.profile.teleg_id, texttosend);
nummsgsent++;
tools.snooze(300)
}
// ++Todo: SLEEP ??? sleep(0.03) // ++Todo: SLEEP ??? sleep(0.03)
} }
} }
@@ -616,7 +639,6 @@ class Telegram {
this.sendMsg(msg.chat.id, nummsgsent + ' ' + getstr(msg.from.language_code, txt.MSG_MSG_SENT)); this.sendMsg(msg.chat.id, nummsgsent + ' ' + getstr(msg.from.language_code, txt.MSG_MSG_SENT));
} }
rec.start_write_msgall = false; rec.start_write_msgall = false;
} }
selectMenuHelp(msg) { selectMenuHelp(msg) {
@@ -654,7 +676,7 @@ class Telegram {
if (msg.text === Menu.SI) { if (msg.text === Menu.SI) {
// Take msg to send to ALL // Take msg to send to ALL
await await
this.sendMsgToAll(rec, msg, rec.msgtosent) this.sendMsgToAll(rec, msg, rec.msgtosent, rec.msgall_staff)
} else { } else {
this.sendMsg(msg.chat.id, txt.MSG_OPERAZ_ANNULLATA); this.sendMsg(msg.chat.id, txt.MSG_OPERAZ_ANNULLATA);
} }
@@ -664,7 +686,10 @@ class Telegram {
if (msg.text !== Menu.INDIETRO) { if (msg.text !== Menu.INDIETRO) {
rec.msgtosent = msg.text; rec.msgtosent = msg.text;
rec.msgall_status = StatusMSGALL.CONFIRM; rec.msgall_status = StatusMSGALL.CONFIRM;
const domanda = 'Confermi d\'Inviare questo messaggio a TUTTI ?\n' + rec.msgtosent; let achi = "TUTTI";
if (rec.msgall_staff)
achi = "STAFF";
const domanda = 'Confermi d\'Inviare questo messaggio a ' + achi + ' ?\n' + rec.msgtosent;
this.ChiediSINO(msg, domanda); this.ChiediSINO(msg, domanda);
} else { } else {
rec.msgall_status = StatusMSGALL.NONE; rec.msgall_status = StatusMSGALL.NONE;
@@ -834,6 +859,14 @@ function getclTelegBytoken(token) {
} }
function getclTelegByidapp(idapp) { function getclTelegByidapp(idapp) {
// ****************************
if (appTelegramFinti.includes(idapp)) {
const ind = appTelegramFinti.indexOf(idapp);
if (ind >= 0)
idapp = appTelegramDest[ind]; // Invia
}
const rec = arrTelegram.find((rec) => rec.idapp === idapp); const rec = arrTelegram.find((rec) => rec.idapp === idapp);
if (!!rec) if (!!rec)
return rec.cl; return rec.cl;

View File

@@ -12,7 +12,7 @@ const Url = require('url-parse');
const { ObjectID } = require('mongodb'); const { ObjectID } = require('mongodb');
const shared_consts = require('../tools/shared_nodejs'); const shared_consts = require('./shared_nodejs');
const mongoose = require('mongoose'); const mongoose = require('mongoose');
const Subscription = mongoose.model('subscribers'); const Subscription = mongoose.model('subscribers');
@@ -56,6 +56,8 @@ textlang = {
'TELEGRAM_NOT_CONNECTED': "Telegram non associato al tuo account!", 'TELEGRAM_NOT_CONNECTED': "Telegram non associato al tuo account!",
'NESSUN_INVITATO': 'Non hai invitato nessuno', 'NESSUN_INVITATO': 'Non hai invitato nessuno',
'ZOOM_PARTECIPATO': 'Partecipazione ad almeno 1 Conferenza (Zoom)', 'ZOOM_PARTECIPATO': 'Partecipazione ad almeno 1 Conferenza (Zoom)',
'LINEE_GUIDA': 'Accettato le Linee Guida',
'VIDEO_INTRO': 'Visto il Video di AYNI',
'SCRITTO_SOGNO': 'Hai scritto il tuo Sogno', 'SCRITTO_SOGNO': 'Hai scritto il tuo Sogno',
'INVITATI': 'persone registrate che hai invitato', 'INVITATI': 'persone registrate che hai invitato',
'NONREG': 'Invitati non Registrati', 'NONREG': 'Invitati non Registrati',
@@ -77,6 +79,8 @@ textlang = {
'TELEGRAM_NOT_CONNECTED': "Telegram non associato al tuo account!", 'TELEGRAM_NOT_CONNECTED': "Telegram non associato al tuo account!",
'NESSUN_INVITATO': 'Non hai invitato nessuno', 'NESSUN_INVITATO': 'Non hai invitato nessuno',
'ZOOM_PARTECIPATO': 'Partecipazione ad almeno 1 Conferenza (Zoom)', 'ZOOM_PARTECIPATO': 'Partecipazione ad almeno 1 Conferenza (Zoom)',
'LINEE_GUIDA': 'Accettato le Linee Guida',
'VIDEO_INTRO': 'Visto il Video di AYNI',
'SCRITTO_SOGNO': 'Hai scritto il tuo Sogno', 'SCRITTO_SOGNO': 'Hai scritto il tuo Sogno',
'INVITATI': 'persone registrate che hai invitato', 'INVITATI': 'persone registrate che hai invitato',
'NONREG': 'Invitati non Registrati', 'NONREG': 'Invitati non Registrati',
@@ -94,6 +98,8 @@ textlang = {
'TELEGRAM_NOT_CONNECTED': "Telegram non associato al tuo account!", 'TELEGRAM_NOT_CONNECTED': "Telegram non associato al tuo account!",
'NESSUN_INVITATO': 'Non hai invitato nessuno', 'NESSUN_INVITATO': 'Non hai invitato nessuno',
'ZOOM_PARTECIPATO': 'Partecipazione ad almeno 1 Conferenza (Zoom)', 'ZOOM_PARTECIPATO': 'Partecipazione ad almeno 1 Conferenza (Zoom)',
'LINEE_GUIDA': 'Accettato le Linee Guida',
'VIDEO_INTRO': 'Visto il Video di AYNI',
'SCRITTO_SOGNO': 'Hai scritto il tuo Sogno', 'SCRITTO_SOGNO': 'Hai scritto il tuo Sogno',
'INVITATI': 'persone registrate che hai invitato', 'INVITATI': 'persone registrate che hai invitato',
'NONREG': 'Invitati non Registrati', 'NONREG': 'Invitati non Registrati',
@@ -488,6 +494,14 @@ module.exports = {
return ''; return '';
}, },
getpathregByIdApp: function (idapp, lang) {
const myapp = MYAPPS.find((item) => item.idapp === idapp);
if (myapp)
return 'registration' + myapp.pathreg_add + '/' + lang;
else
return '';
},
isManagAndAdminDifferent(idapp) { isManagAndAdminDifferent(idapp) {
const manag = this.getManagerEmailByIdApp(idapp); const manag = this.getManagerEmailByIdApp(idapp);
return (manag !== this.getAdminEmailByIdApp(idapp)) && (manag !== ''); return (manag !== this.getAdminEmailByIdApp(idapp)) && (manag !== '');

View File

@@ -1,4 +1,11 @@
module.exports = { module.exports = {
Accepted: {
CHECK_READ_GUIDELINES: 1,
CHECK_SEE_VIDEO_PRINCIPI: 2,
},
ALL_SAW_AND_ACCEPTED: 3,
// ---------------------
FILTER_EXTRALIST_NOT_REGISTERED: 1, FILTER_EXTRALIST_NOT_REGISTERED: 1,
FILTER_EXTRALIST_NOT_CONTACTED: 2, FILTER_EXTRALIST_NOT_CONTACTED: 2,
@@ -23,7 +30,7 @@ module.exports = {
}, },
fieldsUserToChange() { fieldsUserToChange() {
return ['_id', 'username', 'email', 'name', 'surname', 'perm', 'date_reg', 'date_temp_reg', 'verified_email', 'ipaddr', 'lasttimeonline', 'profile', 'calcstat', 'news_on', 'aportador_solidario', 'made_gift', 'ind_order'] return ['_id', 'username', 'email', 'name', 'surname', 'perm', 'date_reg', 'date_temp_reg', 'verified_email', 'ipaddr', 'lasttimeonline', 'profile', 'calcstat', 'news_on', 'aportador_solidario', 'made_gift', 'ind_order', 'numinvitati', 'numinvitatiattivi']
} }
}; };