- Billettera

- Lista Ingressi
 - Send a Tutti la propria Lavagna.
This commit is contained in:
Paolo Arena
2020-02-19 16:09:16 +01:00
parent eccb5bbb57
commit 26715cda44
23 changed files with 1740 additions and 226 deletions

View File

@@ -1,6 +1,6 @@
[Dolphin]
Timestamp=2018,10,26,14,54,10
SortOrder=1
SortRole=modificationtime
Timestamp=2020,2,18,17,19,21
Version=4
[Settings]
HiddenFilesShown=true
ViewMode=1

View File

@@ -0,0 +1,43 @@
p Bienvenue #{name} sur le portail de #{nomeapp} !
p Vos identifiants de connexion à retenir sont :
span Username: 
strong #{username}<br>
span avez-vous oublié votre mot de passe ? :&nbsp;
strong <a href=#{forgetpwd} target="_blank">Essayez ici</a><br>
span Email:&nbsp;
strong #{emailto}<br>
p Cliquez sur le bouton pour confirmer votre inscription :
div.divbtn <a href=#{strlinkreg} target="_blank">
button.btn.btn-lg Vérifier l'enregistrement</a>
p Vous pouvez ensuite accéder à votre espace personnel en entrant votre nom d'utilisateur et votre mot de passe et en cliquant sur &nbsp;
strong ENTREZ<br>
p Donc, une fois que vous avez vérifié votre inscription, connectez-vous au site et &nbsp;
strong COMPLÉTER TOUTES LES ÉTAPES &nbsp;
de la portée du "Guide pas-à-pas" via ce lien:<br>
span <a href=#{strlinksito} target="_blank">#{strlinksito}</a>
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 @@
=`Confirmer l'inscription à ${nomeapp}`

View File

@@ -10,8 +10,13 @@ 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>
p Potrai cosi' accedere alla tua area personale inserendo lo username e la password e cliccando su &nbsp;
strong ACCEDI <br>
p Pertanto una volta Verificata la Registrazione, accedi al sito e &nbsp;
strong COMPLETA TUTTI I PASSI &nbsp;
span della "Guida Passo Passo" tramite questo Link:<br>
span <a href=#{strlinksito} target="_blank">#{strlinksito}</a>
style(type="text/css").

View File

@@ -0,0 +1,43 @@
p Bem-vindo #{nome} ao portal de #{nomeapp}!
p Os seus dados de login a lembrar são:
span Username:&nbsp;
strong #{username}<br>
span você esqueceu sua senha? :&nbsp;
strong <a href=##{forgetpwd} target="_blank">Encontre-o aqui</a>>br>
span Email:&nbsp;
strong #{{emailto}<br>
p Clique no botão para confirmar o seu registo:
div.divbtn <a href=#{strlinkreg} target="_blank">
button.btn.btn-lg Verificação de registro</a>
p Você pode então acessar sua área pessoal digitando seu nome de usuário e senha e clicando em &nbsp;
strong ENTRAR <br>
p Então, uma vez verificada a sua inscrição, inicie a sessão no site e &nbsp;
COMPLETA TODOS OS PASSOS &nbsp;
do "Guia Passo a Passo" através deste link:<br>
span <a href=#{strlinksito} target="_blank">#{strlinksito}</a>
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 @@
=`Confirme o registo em ${nomeapp}`

View File

@@ -0,0 +1,44 @@
Dobrodošli # {name} na portalu # {nomeapp}!
p Vaši podatki za dostop so:
span Username:&nbsp;
strong #{username}<br>
span ste pozabili geslo? :&nbsp;
strong <a href=#{forgetpwd} target="_blank">Poiščite tukaj</a><br>
span Email:&nbsp;
strong #{emailto}<br>
p Za potrditev registracije kliknite na gumb:
div.divbtn <a href=#{strlinkreg} target="_blank">
button.btn.btn-lg Preveri registracijo</a>
p Tako boste lahko dostopali do svojega osebnega območja, tako da vnesete uporabniško ime in geslo in kliknete &nbsp;
strong PRIJAVA <br>
p Potem ko je registracija preverjena, obiščite spletno mesto in &nbsp;
strong IZPOLNITE VSE KORAKE &nbsp;
span "Vodnika po korakih" prek te povezave:<br>
span <a href=#{strlinksito} target="_blank">#{strlinksito}</a>
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 @@
=`Potrdi registracijo za ${nomeapp}`

View File

@@ -0,0 +1,10 @@
p Hola #{nombre},
p #{nomeapp} recientemente recibió una solicitud de una contraseña olvidada.
p Para cambiar la contraseña a #{nomeapp}
p <a href=#{strlinksetpassword} target="_blank">Click HERE</a>
p Si no pediste este cambio, no tienes que hacer nada.
p Este enlace expirará en 4 horas.
Saludos cordiales
p Soporte #{nomeapp}

View File

@@ -0,0 +1 @@
=`Olvidó la contraseña requerida`

View File

@@ -0,0 +1,412 @@
const mongoose = require('mongoose');
const _ = require('lodash');
const tools = require('../tools/general');
const { ListaIngresso } = require('./listaingresso');
const { Settings } = require('./settings');
const { User } = require('./user');
const { ObjectID } = require('mongodb');
const telegrambot = require('../telegram/telegrambot');
const shared_consts = require('../tools/shared_nodejs');
mongoose.Promise = global.Promise;
mongoose.level = "F";
// Resolving error Unknown modifier: $pushAll
mongoose.plugin(schema => {
schema.options.usePushEach = true
});
mongoose.set('debug', process.env.DEBUG);
const BilletteraSchema = new mongoose.Schema({
idapp: {
type: String,
required: true,
},
riga: {
type: Number,
},
col: {
type: Number,
},
indprimario: {
type: Number,
},
parent_indprimario: {
type: Number,
},
date_start: {
type: Date
},
made_gift: {
type: Boolean,
default: false,
},
received_gift: {
type: Boolean,
default: false,
},
created: {
type: Date,
},
num_tess: { // numero di tessitura
type: Boolean,
default: 1
}
});
BilletteraSchema.statics.getTotInLista = async function (idapp) {
const Billettera = this;
const myfind = { idapp };
return await Billettera.count(myfind);
};
BilletteraSchema.statics.findByIndOrder = function (idapp, ind_order) {
const User = this;
try {
return User.findOne({
'idapp': idapp,
'ind_order': ind_order,
});
} catch (e) {
}
};
BilletteraSchema.statics.getFieldsForSearch = function () {
return ['username', 'name', 'surname', 'ind_order']
};
BilletteraSchema.statics.executeQueryTable = function (idapp, params) {
params.fieldsearch = this.getFieldsForSearch();
return tools.executeQueryTable(this, idapp, params);
};
BilletteraSchema.statics.findAllIdApp = function (idapp) {
const Billettera = this;
const myfind = { idapp };
return Billettera.find(myfind, (err, arrrec) => {
return arrrec
});
};
BilletteraSchema.statics.findByRigaCol = function (idapp, riga, col) {
const Billettera = this;
const myfind = { idapp, riga, col };
return Billettera.findOne(myfind, (err, arrrec) => {
return arrrec
});
};
BilletteraSchema.statics.findRecByRigaColParent = async function (idapp, riga, col, numparentUp) {
const Billettera = this;
const myfind = { idapp, riga, col };
let parentup = 0;
let myrec = null;
while (parentup < numparentUp) {
myrec = await Billettera.findOne(myfind);
if (myrec.parent_indprimario === 0)
break;
}
return myrec;
};
function getlimiti(mypos) {
if (mypos.col < 0) {
mypos.col = 0;
}
if (mypos.riga < 0) {
mypos.riga = 0;
mypos.col = 0;
}
return mypos;
}
function getRigaColByPosUp(mypos) {
riga = riga - mypos.numup;
col = Math.ceil(col / (Math.pow(2, mypos.numup)));
if ((col % 2) !== 0)
col++;
}
function getRigaColGenerica(idapp, riga, col, numup) {
mypos = {
riga,
col,
numup
};
if (idapp === tools.AYNI) {
this.getRigaColByPosUp(mypos);
ris = this.getlimiti(mypos);
riga = ris.riga;
col = ris.col;
}
return { riga, col };
}
function getRigaColSognatoreByFuoco(idapp, riga, col) {
return this.getRigaColGenerica(idapp, riga, col, 6);
}
function getRigaColMediatoreByFuoco(idapp, riga, col) {
return this.getRigaColGenerica(idapp, riga, col, 3);
}
BilletteraSchema.statics.findMediatoreByFuoco = function (idapp, riga, col) {
const Billettera = this;
const myrigacol = getRigaColMediatoreByFuoco(idapp, riga, col);
const myfind = { idapp, riga: myrigacol.riga, col: myrigacol.col };
return Billettera.findOne(myfind, (err, arrrec) => {
return arrrec
});
};
function getQueryProj(myfilter) {
const query = [
{ $match: myfilter },
{
$lookup: {
from: "users",
localField: "ind_order",
foreignField: "ind_order", // field in the user collection
as: "user"
}
},
{
$replaceRoot: { newRoot: { $mergeObjects: [{ $arrayElemAt: ["$user", 0] }, "$$ROOT"] } }
},
];
return query;
}
BilletteraSchema.statics.findSognatoreByFuoco = function (idapp, riga, col) {
const Billettera = this;
const myrigacol = getRigaColSognatoreByFuoco(idapp, riga, col);
const myquery = this.getQueryProj({ idapp, riga: myrigacol.riga, col: myrigacol.col });
return Billettera.find(myquery, (err, arrrec) => {
return arrrec
});
};
BilletteraSchema.statics.setRiga = async function (idapp, riga) {
const newrec = new Settings({ key: 'riga' });
newrec._id = new ObjectID();
newrec.idapp = idapp;
newrec.type = tools.FieldType.number;
newrec.value_num = riga;
await newrec.save();
};
BilletteraSchema.statics.getRiga = async function (idapp) {
const ret = await Settings.findOne({ key: 'riga', idapp });
if (!!ret) {
return ret.value_num;
} else {
return 1;
}
};
BilletteraSchema.statics.setCol = async function (idapp, col) {
const newrec = new Settings({ key: 'col' });
newrec._id = new ObjectID();
newrec.idapp = idapp;
newrec.type = tools.FieldType.number;
newrec.value_num = col;
await newrec.save();
};
BilletteraSchema.statics.getCol = async function (idapp) {
const ret = await Settings.findOne({ key: 'col', idapp });
if (!!ret) {
return ret.value_num;
} else {
return 1;
}
};
function getmaxcol(riga) {
let maxcol = 1;
if (riga === 1) {
maxcol = 1;
} else if (riga === 2) {
maxcol = 2;
} else {
maxcol = Math.pow(riga - 1, 2);
}
return maxcol;
}
function getPrimoFuocoByIndCol(col) {
return Math.ceil(col / 8) + (col % 8);
}
function getusertextbyrec(myrec, symbol) {
return symbol + ' ' + recfuoco.ind_order + ' (' + recfuoco.name + ' ' + recfuoco.surname + ')';
}
BilletteraSchema.statics.getPlaccaByFuoco = async function (idapp, riga, col) {
const Billettera = this;
try {
let recsognatore = await Billettera.findSognatoreByFuoco(idapp, riga, col);
let recmediatore = await Billettera.findMediatoreByFuoco(idapp, riga, col);
let primofuoco = this.getPrimoFuocoByIndCol(col);
mystr = '🌈 Dreamer ' + this.getusertextbyrec(recsognatore, '🔥') + tools.ACAPO;
mystr = '🌈 Mediator ' + this.getusertextbyrec(recmediatore, '🔥') + tools.ACAPO;
mystr = '🔥🌏💦💨🔥🌏💦💨' + tools.ACAPO;
for (let indcol = primofuoco; indcol < primofuoco + 8; indcol++) {
let recfuoco = await Billettera.findByRigaCol(idapp, riga, indcol);
mystr += this.getusertextbyrec(recfuoco, '🔥') + tools.ACAPO;
}
} catch (e) {
console.error(e);
}
}
function Fuochi8Completati(idapp, riga, col) {
// Inviare un msg al Mediatore che può aprire la Chat con gli 8 fuochi
// Inviare un msg a questi 8 Fuochi, che la loro placca è Pronta !
txt = '';
// Inviare la placca a Managers
telegrambot.sendMsgTelegramToTheManagers(idapp, txt);
}
BilletteraSchema.statics.generaBillettera = async function (idapp) {
const Billettera = this;
let riga = await Billettera.getRiga(idapp);
let col = await Billettera.getCol(idapp);
let primavolta = (riga === 1) && (col === 1);
primavolta = false;
const recfindFondo = await Billettera.findByRigaCol(idapp, 0, 0);
if (!recfindFondo) {
billettera = new Billettera({ idapp, indprimario: 0, riga: 0, col: 0 });
billettera.created = new Date();
await billettera.save();
const UserFondo = await User.findByIndOrder(idapp, 0);
if (!UserFondo) {
telegrambot.sendMsgTelegramToTheAdmin(idapp, 'Devi creare l\'utente FONDO , con ind_order = 0 ! ');
}
}
let maxcol = getmaxcol(riga);
// Identifica il prossimo d'aggiungere
arrlistaingresso = await ListaIngresso.find({ 'idapp': idapp, added: false }).sort({ indprimario: 1 });
let conta = 0;
let colparent = Math.ceil(col / 2);
let rigaparent = riga - 1;
for (const reclista of arrlistaingresso) {
billettera = new Billettera({ idapp, indprimario: reclista.indprimario, riga, col });
billettera.created = new Date();
const recfind = await Billettera.findByRigaCol(idapp, rigaparent, colparent);
if (!!recfind) {
billettera.parent_indprimario = recfind.indprimario;
} else {
billettera.parent_indprimario = 0;
}
await billettera.save()
.then(async (result) => {
let fields_to_update = { added: true };
const ris = await ListaIngresso.findOneAndUpdate({ _id: reclista._id.toString() }, { $set: fields_to_update }, { new: false });
await Billettera.setRiga(idapp, riga);
await Billettera.getCol(idapp, col);
conta++;
// Check if Billetera has Completed
if (idapp === tools.AYNI) {
if ((col % 8) === 0) {
// Completed 8 people
let text = 'Completata Billettera [riga=' + riga + ',col=' + col + ']';
tools.writeBilletteraLog(text);
if (!primavolta) {
telegrambot.sendMsgTelegramToTheManagers(idapp, text);
this.Fuochi8Completati(idapp, riga, col);
}
}
}
// Next
if (col === maxcol) {
riga++;
rigaparent = riga - 1;
col = 1;
maxcol = getmaxcol(riga);
} else {
col++;
}
if ((col % 2) !== 0)
colparent++;
});
}
};
const Billettera = mongoose.model('Billettera', BilletteraSchema);
module.exports = { Billettera };

View File

@@ -53,7 +53,7 @@ CalZoomSchema.statics.findAllIdApp = async function (idapp) {
const myfind = { idapp, date_start: { $gt: tools.IncDateNow(-1000 * 60 * 60 * 3) } };
return await CalZoom.find(myfind).sort({ date_start: 1 });
return await CalZoom.find(myfind).sort({ date_start: 1 }).limit(4);
};
CalZoomSchema.statics.getNextZoom = async function (idapp) {

View File

@@ -145,10 +145,10 @@ ExtraListSchema.statics.findByCellAndNameSurname = function (idapp, cell_complet
};
ExtraListSchema.statics.findByIndOrder = function (idapp, ind_order) {
const User = this;
const ExtraList = this;
try {
return User.findOne({
return ExtraList.findOne({
'idapp': idapp,
'ind_order': ind_order,
});
@@ -321,13 +321,6 @@ ExtraListSchema.statics.ImportData = async function (locale, idapp, strdata) {
};
if (tools.INITDB_FIRSTIME) {
console.log(' createIndex User Index...');
// ExtraListSchema.index({ username: 'text', name: 'text', surname: 'text', email: 'text' });
// ExtraListSchema.index({ name: 'name' });
// ExtraListSchema.index({ name: 1 });
// ExtraListSchema.index({ surname: 1 });
}
const ExtraList = mongoose.model('ExtraList', ExtraListSchema);

View File

@@ -0,0 +1,137 @@
var bcrypt = require('bcryptjs');
const mongoose = require('mongoose');
const validator = require('validator');
const jwt = require('jsonwebtoken');
const _ = require('lodash');
const tools = require('../tools/general');
const shared_consts = require('../tools/shared_nodejs');
const queryclass = require('../classes/queryclass');
mongoose.Promise = global.Promise;
mongoose.level = "F";
// Resolving error Unknown modifier: $pushAll
mongoose.plugin(schema => {
schema.options.usePushEach = true
});
mongoose.set('debug', process.env.DEBUG);
const ListaIngressoSchema = new mongoose.Schema({
idapp: {
type: String,
required: true,
},
indprimario: {
type: Number,
},
ind_order: {
type: Number,
},
username: {
type: String,
},
name: {
type: String,
},
surname: {
type: String,
},
added: { // Added into Programmation (Billettera)
type: Boolean,
default: false,
}
});
ListaIngressoSchema.pre('save', async function (next) {
if (this.isNew) {
const myrec = await ListaIngresso.findOne().limit(1).sort({indprimario:-1});
if (!!myrec) {
if (myrec._doc.indprimario === 0)
this.indprimario = 1;
else
this.indprimario = myrec._doc.indprimario + 10;
} else {
this.indprimario = 10;
}
}
next();
});
// ListaIngressoSchema.methods.toJSON = function () {
// const ListaIngresso = this;
// const userObject = ListaIngresso.toObject();
//
// return _.pick(userObject, ['_id', ...shared_consts.fieldsUserToChange()]);
// };
//
ListaIngressoSchema.statics.findByUsername = function (idapp, username) {
const ListaIngresso = this;
return ListaIngresso.findOne({
'idapp': idapp,
'username': username,
});
};
ListaIngressoSchema.statics.getTotInLista = async function (idapp) {
const ListaIngresso = this;
const myfind = { idapp };
return await ListaIngresso.count(myfind);
};
ListaIngressoSchema.statics.getOrderedList = function (idapp) {
const ListaIngresso = this;
return ListaIngresso.findOne({ idapp }).sort({ indprimario: -1 })
};
ListaIngressoSchema.statics.findByIndOrder = function (idapp, ind_order) {
const ListaIngresso = this;
try {
return ListaIngresso.findOne({
'idapp': idapp,
'ind_order': ind_order,
});
} catch (e) {
}
};
ListaIngressoSchema.statics.getFieldsForSearch = function () {
return ['username', 'name', 'surname', 'ind_order']
};
ListaIngressoSchema.statics.executeQueryTable = function (idapp, params) {
params.fieldsearch = this.getFieldsForSearch();
return tools.executeQueryTable(this, idapp, params);
};
ListaIngressoSchema.statics.findAllIdApp = function (idapp) {
const ListaIngresso = this;
const myfind = { idapp };
return ListaIngresso.find(myfind, (err, arrrec) => {
return arrrec
});
};
const ListaIngresso = mongoose.model('ListaIngresso', ListaIngressoSchema);
module.exports = { ListaIngresso };

View File

@@ -7,8 +7,12 @@ const _ = require('lodash');
const tools = require('../tools/general');
const { Settings } = require('../models/settings');
const { ListaIngresso } = require('../models/listaingresso');
const { Billettera } = require('./billettera');
const { ExtraList } = require('../models/extralist');
const { ObjectID } = require('mongodb');
const shared_consts = require('../tools/shared_nodejs');
const queryclass = require('../classes/queryclass');
@@ -160,6 +164,9 @@ const UserSchema = new mongoose.Schema({
teleg_id: {
type: Number
},
teleg_id_old: {
type: Number
},
teleg_checkcode: {
type: Number
},
@@ -178,6 +185,9 @@ const UserSchema = new mongoose.Schema({
saw_zoom_presentation: {
type: Boolean
},
special_req: {
type: Boolean
},
sex: {
type: Number,
},
@@ -316,14 +326,24 @@ UserSchema.statics.findByCredentials = function (idapp, username, password) {
};
UserSchema.statics.findByUsername = function (idapp, username) {
UserSchema.statics.findByUsername = async function (idapp, username, alsoemail) {
const User = this;
// /^bar$/i
const regexusername = new RegExp(["^", username, "$"].join(""), "i");
return User.findOne({
return await User.findOne({
'idapp': idapp,
'username': username,
'username': regexusername,
}).then(async (ris) => {
if ((!ris) && (alsoemail)) {
regexemail = new RegExp(["^", username.toLowerCase(), "$"].join(""), "i");
return await User.findOne({
'idapp': idapp,
'email': regexemail,
});
}
return ris;
});
};
@@ -360,6 +380,7 @@ UserSchema.statics.getUserShortDataByUsername = async function (idapp, username)
});
if (myrec) {
myrec.qualified = await User.isUserQualified7(idapp, myrec.username);
myrec.numinvitati = await User.getnumInvitati(idapp, myrec.username);
myrec.numinvitatiattivi = await User.getnumInvitatiAttivi(idapp, myrec.username);
}
@@ -395,6 +416,7 @@ UserSchema.statics.getDownlineByUsername = async function (idapp, username) {
if (!!arrrec) {
for (const rec of arrrec) {
rec._doc.qualified = await User.isUserQualified7(idapp, rec.username);
rec._doc.numinvitati = await User.getnumInvitati(idapp, rec.username);
rec._doc.numinvitatiattivi = await User.getnumInvitatiAttivi(idapp, rec.username);
}
@@ -411,9 +433,55 @@ UserSchema.statics.getnumInvitatiAttivi = function (idapp, username) {
return User.count({
idapp,
aportador_solidario: username,
verified_email: true,
'profile.teleg_id': { $gt: 1 },
'profile.saw_and_accepted': shared_consts.ALL_SAW_AND_ACCEPTED,
'profile.saw_zoom_presentation': true,
'profile.saw_and_accepted': true,
'profile.my_dream': { $exists: true },
$and: [
{ "$expr": { "$gt": [{ "$strLenCP": "$profile.my_dream" }, 10] } },
{ "$expr": { "$gt": [{ "$strLenCP": "$profile.email_paypal" }, 6] } }
],
$where: "this.profile.paymenttypes.length >= 1",
'profile.email_paypal': { $exists: true },
});
};
UserSchema.statics.isUserQualified7 = async function (idapp, username) {
const User = this;
const myrec = await User.findOne({
'idapp': idapp,
'username': username,
$or: [
{
special_req: true
},
{
verified_email: true,
'profile.teleg_id': { $gt: 1 },
'profile.saw_and_accepted': shared_consts.ALL_SAW_AND_ACCEPTED,
'profile.saw_zoom_presentation': true,
'profile.my_dream': { $exists: true },
'profile.email_paypal': { $exists: true },
$and: [
{ "$expr": { "$gt": [{ "$strLenCP": "$profile.my_dream" }, 10] } },
{ "$expr": { "$gt": [{ "$strLenCP": "$profile.email_paypal" }, 6] } }
],
$where: "this.profile.paymenttypes.length >= 1",
}]
});
return !!myrec;
};
UserSchema.statics.getnumPaymentOk = function (idapp) {
const User = this;
return User.count({
idapp,
$where: "this.profile.paymenttypes.length >= 1",
'profile.email_paypal': { $exists: true },
});
};
@@ -488,6 +556,21 @@ UserSchema.statics.getLastUser = function (idapp) {
return User.findOne({ idapp }).sort({ ind_order: -1 })
};
UserSchema.statics.findByIndOrder = function (idapp, ind_order) {
const User = this;
try {
return User.findOne({
'idapp': idapp,
'ind_order': ind_order,
});
} catch (e) {
}
};
UserSchema.pre('save', function (next) {
const user = this;
@@ -561,7 +644,7 @@ UserSchema.statics.TelegIdByUsername = async function (idapp, username) {
});
};
UserSchema.statics.SetTelegramCheckCode = async function (idapp, username, teleg_checkcode) {
UserSchema.statics.SetTelegramCheckCode = async function (idapp, id, teleg_checkcode) {
const User = this;
const fields_to_update = {
@@ -569,25 +652,42 @@ UserSchema.statics.SetTelegramCheckCode = async function (idapp, username, teleg
};
return await User.findOneAndUpdate({
idapp,
username
_id: id
}, { $set: fields_to_update }, { new: false }).then((record) => {
return !!record;
});
};
UserSchema.statics.SetTelegramIdSuccess = async function (idapp, username, teleg_id) {
UserSchema.statics.SetTelegramIdSuccess = async function (idapp, id, teleg_id) {
const User = this;
const fields_to_update = {
'profile.teleg_id': teleg_id,
'profile.teleg_id_old': 0,
'profile.teleg_checkcode': 0
};
return await User.findOneAndUpdate({
idapp,
username
_id: id
}, { $set: fields_to_update }, { new: false }).then((record) => {
return record;
});
};
UserSchema.statics.SetTelegramWasBlocked = async function (idapp, teleg_id) {
const User = this;
const fields_to_update = {
'profile.teleg_id_old': teleg_id,
'profile.teleg_id': 0,
};
const ris = await User.findOneAndUpdate({
idapp,
'profile.teleg_id': teleg_id
}, { $set: fields_to_update }, { new: false }).then((record) => {
return record;
});
@@ -609,7 +709,7 @@ UserSchema.statics.getNameSurnameByUsername = async function (idapp, username) {
UserSchema.statics.getusersManagers = async function (idapp) {
const User = this;
return await User.find({ idapp, 'profile.manage_telegram': true }, { 'profile.teleg_id': 1 })
return await User.find({ idapp, 'profile.manage_telegram': true }, { 'profile.teleg_id': 1, perm: 1 })
.then((arrrec) => {
return (!!arrrec) ? arrrec : null;
}).catch((e) => {
@@ -620,11 +720,11 @@ UserSchema.statics.getusersManagers = async function (idapp) {
UserSchema.statics.getUsersTelegALL = async function (idapp) {
const User = this;
return await User.find({ idapp, 'profile.teleg_id': { $gt: 0 } }, { 'profile.teleg_id': 1, perm: 1 })
return await User.find({ idapp, 'profile.teleg_id': { $gt: 0 } })
.then((arrrec) => {
return (!!arrrec) ? arrrec : null;
}).catch((e) => {
console.error('getusersManagers', e);
console.error('getUsersTelegALL', e);
});
};
@@ -813,6 +913,58 @@ UserSchema.statics.getUsersRegistered = async function (idapp) {
return await User.count(myfind);
};
UserSchema.statics.getUsersQualified = async function (idapp, numinvitati) {
const User = this;
const arrusers = await User.find({
idapp,
$or: [
{
special_req: true
},
{
verified_email: true,
'profile.teleg_id': { $gt: 0 },
$where: "this.profile.paymenttypes.length >= 1",
'profile.saw_and_accepted': shared_consts.ALL_SAW_AND_ACCEPTED,
'profile.saw_zoom_presentation': true,
'profile.my_dream': { $exists: true },
$and: [
{ "$expr": { "$gt": [{ "$strLenCP": "$profile.my_dream" }, 10] } },
{ "$expr": { "$gt": [{ "$strLenCP": "$profile.email_paypal" }, 6] } }
],
}]
}, {
'username': 1,
});
if (numinvitati === 0)
return arrusers; // PRENDI TUTTI
let arrris = [];
for (const rec of arrusers) {
rec.numinvitatiattivi = await User.getnumInvitatiAttivi(idapp, rec.username);
if (rec.numinvitatiattivi >= numinvitati) {
arrris.push(rec);
}
}
return arrris
};
UserSchema.statics.getNumUsersQualified = async function (idapp, numinvitati) {
arrrec = await this.getUsersQualified(idapp, numinvitati);
return arrrec.length
};
UserSchema.statics.getEmailNotVerified = async function (idapp) {
const User = this;
@@ -964,6 +1116,47 @@ if (tools.INITDB_FIRSTIME) {
// UserSchema.index({ surname: 1 });
}
async function addUtentiInLista(idapp, mode) {
let num = 0;
for (const rec of arrusers) {
let ok = false;
let qualified = await User.isUserQualified7(idapp, rec.username);
let numinvitatiattivi = await User.getnumInvitatiAttivi(idapp, rec.username);
if (mode === 1) {
// 9 punti qualificati
ok = qualified && (numinvitatiattivi >= 2);
} else if (mode === 2) {
// 7 punti qualificati
ok = qualified;
} else {
ok = true;
// // almeno telegram ID
// ok = user.profile.teleg_id > 0;
// } else {
// ok = true;
}
if (ok) {
if (!await ListaIngresso.findByUsername(idapp, rec.username)) {
let listaingresso = new ListaIngresso({
username: rec.username,
ind_order: rec.ind_order,
name: rec.name,
surname: rec.surname,
idapp,
_id: new ObjectID()
});
await listaingresso.save();
num++;
}
}
}
return num;
}
UserSchema.statics.DbOp = async function (idapp, mydata) {
const User = this;
try {
@@ -971,14 +1164,52 @@ UserSchema.statics.DbOp = async function (idapp, mydata) {
arrusers = await User.find({ 'idapp': idapp });
let num = 0;
for (const rec of arrusers) {
let mycell = tools.removespaces(rec.profile.intcode_cell + rec.profile.cell);
await User.findOneAndUpdate({ _id: rec._id }, { $set: { 'profile.cell': mycell } })
num++;
// DISATTIVATO: ORA NON MI SERVE PIU
if (false) {
let mycell = tools.removespaces(rec.profile.intcode_cell + rec.profile.cell);
await User.findOneAndUpdate({ _id: rec._id }, { $set: { 'profile.cell': mycell } });
num++;
}
}
return { num };
// return await User.updateMany({ idapp }, { $set: { 'profile.cell': { $concat: ["$profile.intcode_cell", "$profile.cell"] } } })
} else if (mydata.dbop === 'changeEmailLowerCase') {
arrusers = await User.find({ 'idapp': idapp });
let num = 0;
for (const rec of arrusers) {
let myemail = rec.email.toLowerCase();
if (myemail !== rec.email) {
await User.findOneAndUpdate({ _id: rec._id }, { $set: { 'email': myemail } });
num++;
}
}
return { num };
} else if (mydata.dbop === 'creaLista') {
await ListaIngresso.remove({ idapp });
arrusers = await User.find({ 'idapp': idapp }).sort({ ind_order: 1 });
let num = 0;
num += await addUtentiInLista(idapp, 1);
num += await addUtentiInLista(idapp, 2);
// num += await addUtentiInLista(idapp, 3);
// num += await addUtentiInLista(idapp, 4);
return { num };
} else if (mydata.dbop === 'creaBillettera') {
const num = await Billettera.generaBillettera(idapp);
return { num };
} else if (mydata.dbop === 'visuPlacca') {
const placca = await Billettera.getPlaccaByFuoco(idapp, riga, col);
return { placca };
}
} catch (e) {
console.error(e);
@@ -987,6 +1218,7 @@ UserSchema.statics.DbOp = async function (idapp, mydata) {
};
const User = mongoose.model('User', UserSchema);

View File

@@ -77,7 +77,7 @@ router.post(process.env.LINKVERIF_REG, (req, res) => {
user.lasttimeonline = new Date();
user.save().then(() => {
//console.log("TROVATOOOOOO!");
res.send({ code: server_constants.RIS_CODE_EMAIL_VERIFIED, msg: tools.getres__('EMAIL_VERIF', res) });
res.send({ code: server_constants.RIS_CODE_EMAIL_VERIFIED, msg: tools.getres__('EMAIL', res) + ' ' + tools.getres__('VERIF', res) });
});
}
}
@@ -130,7 +130,7 @@ router.post(process.env.LINK_UPDATE_PWD, (req, res) => {
const msg = "Richiesta Nuova Password: idapp= " + idapp + " email = " + email;
console.log(msg);
telegrambot.sendMsgTelegramToTheManagers(body.idapp, msg);
// telegrambot.sendMsgTelegramToTheManagers(body.idapp, msg);
User.findByLinkTokenforgot(idapp, email, tokenforgot).then((user) => {
if (!user) {

View File

@@ -29,6 +29,9 @@ router.post('/load', async (req, res) => {
email_non_verif: await User.getEmailNotVerified(idapp),
num_teleg_attivo: await User.getUsersTelegramAttivo(idapp),
num_teleg_pending: await User.getUsersTelegramPending(idapp),
num_qualificati: await User.getNumUsersQualified(idapp, 2),
num_requisiti: await User.getNumUsersQualified(idapp, 0),
num_modalita_pagamento: await User.getnumPaymentOk(idapp),
num_part_zoom: await User.getUsersZoom(idapp),
num_part_accepted: await User.getSaw_and_Accepted(idapp),
num_users_dream: await User.getUsersDreams(idapp),

View File

@@ -49,6 +49,8 @@ router.post('/', async (req, res) => {
const body = _.pick(req.body, ['email', 'password', 'username', 'name', 'surname', 'idapp', 'keyappid', 'lang', 'profile', 'aportador_solidario']);
const user = new User(body);
body.email = body.email.toLowerCase();
// tools.mylog("LANG PASSATO = " + user.lang, "IDAPP", user.idapp);
user.linkreg = reg.getlinkregByEmail(body.idapp, body.email, body.username);
@@ -104,16 +106,13 @@ router.post('/', async (req, res) => {
let recextra = null;
recextra = await ExtraList.findByCellAndNameSurname(user.idapp, user.profile.cell, user.name, user.surname);
let nomeaportador_corretto = "";
if (recextra) {
nomeaportador_corretto = recextra.aportador_solidario_name_surname;
if (nomeaportador_corretto === '')
nomeaportador_corretto = recextra.aportador_solidario_originale_name_surname;
}
// recextra = await ExtraList.findByCellAndNameSurname(user.idapp, user.profile.cell, user.name, user.surname);
// let nomeaportador_corretto = "";
// if (recextra) {
// nomeaportador_corretto = recextra.aportador_solidario_name_surname;
// if (nomeaportador_corretto === '')
// nomeaportador_corretto = recextra.aportador_solidario_originale_name_surname;
// }
const lastuser = await User.getLastUser(user.idapp);
const lastextra = await ExtraList.getLastUser(user.idapp);
@@ -130,6 +129,27 @@ router.post('/', async (req, res) => {
if (lastindorder > 0)
user.ind_order = lastindorder + 1;
const numero = user.name.slice(-1);
if ((numero === '2') || (numero === '3') || (numero === '4')) {
recorig = await User.findByCellAndNameSurname(user.idapp, user.profile.cell, user.name.slice(0, -1), user.surname);
if (!!recorig) {
user.profile.teleg_id = recorig.profile.teleg_id;
user.profile.saw_zoom_presentation = recorig.profile.saw_zoom_presentation;
user.profile.saw_and_accepted = recorig.profile.saw_and_accepted;
user.profile.email_paypal = recorig.profile.email_paypal;
user.profile.paymenttypes = recorig.profile.paymenttypes;
let msgseconda = '!!! REGISTRATA ';
if (numero === '2')
msgseconda += 'SECONDA';
else if (numero === '3')
msgseconda += 'TERZA';
else if (numero === '4')
msgseconda += 'QUARTA';
msgseconda += ' UTENZA di ' + recorig.name + ' ' + recorig.surname + ' (' + recorig.username + ') : ' + user.name + ' ' + user.surname + ' (' + user.username + ') ';
telegrambot.sendMsgTelegramToTheManagers(user.idapp, msgseconda);
}
}
namesurname_aportador_reg = await User.getNameSurnameByUsername(user.idapp, user.aportador_solidario);
@@ -184,7 +204,7 @@ router.post('/', async (req, res) => {
return await user.save()
.then(async () => {
return await User.findByUsername(user.idapp, user.username)
return await User.findByUsername(user.idapp, user.username, false)
.then((usertrovato) => {
// tools.mylog("TROVATO USERNAME ? ", user.username, usertrovato);
@@ -228,7 +248,7 @@ router.get('/:idapp/:username', (req, res) => {
var username = req.params.username;
const idapp = req.params.idapp;
User.findByUsername(idapp, username).then((user) => {
User.findByUsername(idapp, username, false).then((user) => {
if (!user) {
return res.status(404).send();
}
@@ -331,6 +351,7 @@ router.post('/login', (req, res) => {
code: server_constants.RIS_CODE_OK,
subsExistonDb: myris.subsExistonDb
});
// tools.mylog("TROVATOOO!");
// tools.mylog('FINE LOGIN')

View File

@@ -162,6 +162,7 @@ module.exports = {
dataemail: await this.getdataemail(idapp),
locale: lang,
nomeapp: tools.getNomeAppByIdApp(idapp),
strlinksito: tools.getHostByIdApp(idapp),
strlinkreg: this.getlinkReg(idapp, idreg),
username: user.username,
name: user.name,

View File

@@ -290,10 +290,23 @@ async function resetProcessingJob() {
// console.log(`Server started at port ${port}`);
//});
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!`);
async function inizia() {
if (process.env.NODE_ENV === 'production') {
await telegrambot.sendMsgTelegram(tools.AYNI, telegrambot.ADMIN_USER_SERVER, `Ciao ${telegrambot.ADMIN_USER_NAME_SERVER}!`);
await telegrambot.sendMsgTelegramByIdTelegram(tools.AYNI, 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!`);
await telegrambot.sendMsgTelegramByIdTelegram('2', telegrambot.ADMIN_IDTELEGRAM_SERVER, `Il Server ${process.env.DATABASE} è appena ripartito!`);
testo = 'Ciao Paolo!';
myid = await telegrambot.sendMsgTelegramByIdTelegram(tools.AYNI, telegrambot.ADMIN_IDTELEGRAM_SERVER, testo);
}
// testo = 'testo modificato';
// myid = await telegrambot.sendMsgTelegramByIdTelegram('7', telegrambot.ADMIN_IDTELEGRAM_SERVER, testo, myid, telegrambot.ADMIN_IDTELEGRAM_SERVER);
}
inizia();
resetProcessingJob();

File diff suppressed because it is too large Load Diff

View File

@@ -22,6 +22,9 @@ const server_constants = require('./server_constants');
// SETTINGS WebPush Configuration
const webpush = require('web-push');
const FILELOG = 'filelog.txt';
const FILEEVENTS = 'logevents.txt';
const FILEBILLETTERA = 'logBillettera.txt';
const subject = process.env.URLBASE_APP1;
const publicVapidKey = process.env.PUBLIC_VAPI_KEY;
const privateVapidKey = process.env.PRIVATE_VAPI_KEY;
@@ -45,13 +48,21 @@ textlang = {
"Nuova Registrazione": "Nuova Registrazione",
"Effettuata una Nuova Registrazione": "Effettuata una Nuova Registrazione",
"partecipanti": "partecipanti",
'TESTO_ASSISTENZA': "Per entrare nel Sito AYNI:\nhttps://ayni.gifteconomy.app\n\nHai dimenticato la Password per accedere al sito?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\nChat AYNI BOT (questa):\nhttps://t.me/notevoleaynibot\n\nChat AYNI-BiblioBacheca: https://t.me/joinchat/AL2qKExZKvenLgpVhOyefQ \n\nChat di Aiuto e Supporto: 'AYNI Help & Support'\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n1 - Fai la tua domanda e chiedi assistenza.\n2 - Dopo aver ricevuto aiuto esci dalla chat.\nPotrai rientrare ogni qualvolta ne avrai la necessità.",
'TESTO_ASSISTENZA': "Per entrare nel Sito AYNI:\nhttps://ayni.gifteconomy.app\n\nHai dimenticato la Password per accedere al sito?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\nChat AYNI BOT (questa):\nhttps://t.me/notevoleaynibot\n\nChat AYNI - EMPOWER: Entra ⛩ nella nostra Community chat:\n https://t.me/joinchat/C741mkx5QYXu-kyYCYvA8g\n\nChat AYNI-BIBLIO: https://t.me/joinchat/AL2qKExZKvenLgpVhOyefQ \n\nChat di Aiuto e Supporto: 'AYNI - HELP'\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n1 - Fai la tua domanda e chiedi assistenza.\n2 - Dopo aver ricevuto aiuto esci dalla chat.\nPotrai rientrare ogni qualvolta ne avrai la necessità.",
'BENVENUTO': "Benvenuto",
'INFO_LA_MIA_LAVAGNA': 'In questa sezione puoi controllare se hai completato la lista dei requisiti per entrare in programmazione Bigliettera:\n',
'INFO_LAVAGNA_SITO': 'Per accedere al menu completo vai sul sito %s, clicca sulle 3 linee in alto a sinistra ed accedi alla voce "La tua Lavagna".\n',
'HAI_I_7_REQUISITI': 'PRIMI PASSI OK!\nHai i Primi 7 Requisiti per Entrare in programmazione!',
'NON_HAI_I_7_REQUISITI': 'Attenzione!\nAncora non hai i 7 Requisiti per Entrare in programmazione!',
'HAI_I_9_REQUISITI': 'COMPLIMENTI!\nHai TUTTI i 9 Requisiti per poter effettuare e poi ricevere il tuo Dono!',
'NON_HAI_I_9_REQUISITI': 'Attenzione!\nAncora non hai Tutti i 9 Requisiti per poter effettuare e poi ricevere il tuo Dono!',
'INFO_LA_MIA_LAVAGNA': '✨ Lista dei Requisiti: ✨ \n',
'INFO_LAVAGNA_SITO_COMPLETARE': 'Per completare tutti i requisiti vai sul sito:\n%s\nPer vedere lo stato dei tuoi invitati, clicca sulle 3 linee in alto a sinistra ed accedi alla voce "Lavagna".\n',
'INFO_LAVAGNA_SITO': 'Per vedere lo stato dei tuoi invitati, sul sito AYNI, clicca sulle 3 linee in alto a sinistra ed accedi alla voce "Lavagna".\n',
'INFO_LINK_DA_CONDIVIDERE': 'Link da condividere ai tuoi invitati per farli registrare al sito di Ayni:\n%s\n\nLink da condividere per partecipare allo Zoom (Conferenza OnLine):\n%s',
'ZOOM_CONFERENCE': 'Qui trovi le date di programmazione agli Zoom:',
'EMAIL_VERIF': "Email Verificata",
"NON_VERIF": "Non Verificata",
"VERIF": "Verificata",
'EMAIL': "Email",
'BOT': "AYNI BOT",
'EMAIL_NON_VERIF': "Email Non Verificata\nleggi la tua casella email e trova **\"Confermare la Registrazione a Ayni\"**<br>e clicca sul bottone **\"Verifica Registrazione\"**",
'TELEGRAM_NOT_CONNECTED': "Telegram non associato al tuo account!",
'NESSUN_INVITATO': 'Non hai invitato nessuno',
@@ -59,22 +70,36 @@ textlang = {
'LINEE_GUIDA': 'Accettato le Linee Guida',
'VIDEO_INTRO': 'Visto il Video di AYNI',
'SCRITTO_SOGNO': 'Hai scritto il tuo Sogno',
'PAYMENTS': 'Modalità di Pagamento',
'INVITATI': 'persone registrate che hai invitato',
'INVITATI_ATTIVI': 'Invitati con i 7 Requisiti',
'NONREG': 'Invitati non Registrati',
'CLICCA_PER_ZOOM': 'AL GIORNO E ORA INDICATA, PER ENTRARE NELLA VIDEO-CONFERENZA, CLICCA QUI',
'CLICCA_ENTRA': 'CLICCA QUI PER ENTRARE !',
'ZOOM_INIZIATO': 'QUESTA CONFERENZA E\' INIZIATA!',
'SCEGLI_VOCE': 'scegli una voce:',
'INVITATI_LISTA': 'I Tuoi Invitati (in verde con almeno i primi 7 Requisiti)',
},
es: {
"L'Email è già stata Verificata": "L'Email è già stata Verificata",
"Nuova Registrazione": "Nuevo Registro",
"Effettuata una Nuova Registrazione": "Se ha realizado un nuevo registro",
"partecipanti": "participantes",
'TESTO_ASSISTENZA': "Per entrare nel Sito AYNI:\nhttps://ayni.gifteconomy.app\n\nHai dimenticato la Password per accedere al sito?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\nChat AYNI BOT (questa):\nhttps://t.me/notevoleaynibot\n\nChat AYNI-BiblioBacheca: https://t.me/joinchat/AL2qKExZKvenLgpVhOyefQ \n\nChat di Aiuto e Supporto: 'AYNI Help & Support'\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n1 - Fai la tua domanda e chiedi assistenza.\n2 - Dopo aver ricevuto aiuto esci dalla chat.\nPotrai rientrare ogni qualvolta ne avrai la necessità.",
'TESTO_ASSISTENZA': "Per entrare nel Sito AYNI:\nhttps://ayni.gifteconomy.app\n\nHai dimenticato la Password per accedere al sito?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\nChat AYNI BOT (questa):\nhttps://t.me/notevoleaynibot\n\nChat AYNI - EMPOWER: Entra ⛩ nella nostra Community chat:\n https://t.me/joinchat/C741mkx5QYXu-kyYCYvA8g\n\nChat AYNI-BIBLIO: https://t.me/joinchat/AL2qKExZKvenLgpVhOyefQ \n\nChat di Aiuto e Supporto: 'AYNI - HELP'\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n1 - Fai la tua domanda e chiedi assistenza.\n2 - Dopo aver ricevuto aiuto esci dalla chat.\nPotrai rientrare ogni qualvolta ne avrai la necessità.",
'BENVENUTO': "Benvenuto",
'INFO_LA_MIA_LAVAGNA': 'In questa sezione puoi controllare se hai completato la lista dei requisiti per entrare in programmazione Bigliettera:\n',
'INFO_LAVAGNA_SITO': 'Per accedere al menu completo vai sul sito %s, clicca sulle 3 linee in alto a sinistra ed accedi alla voce "La tua Lavagna".\n',
'HAI_I_7_REQUISITI': 'PRIMI PASSI OK!\nHai i Primi 7 Requisiti per Entrare in programmazione!',
'NON_HAI_I_7_REQUISITI': 'Attenzione!\nAncora non hai i 7 Requisiti per Entrare in programmazione!',
'HAI_I_9_REQUISITI': 'COMPLIMENTI!\nHai TUTTI i 9 Requisiti per poter effettuare e poi ricevere il tuo Dono!',
'NON_HAI_I_9_REQUISITI': 'Attenzione!\nAncora non hai Tutti i 9 Requisiti per poter effettuare e poi ricevere il tuo Dono!',
'INFO_LA_MIA_LAVAGNA': '✨ Lista dei Requisiti: ✨ \n',
'INFO_LAVAGNA_SITO_COMPLETARE': 'Per completare tutti i requisiti vai sul sito:\n%s\nPer vedere lo stato dei tuoi invitati, clicca sulle 3 linee in alto a sinistra ed accedi alla voce "Lavagna".\n',
'INFO_LAVAGNA_SITO': 'Per vedere lo stato dei tuoi invitati, sul sito AYNI, clicca sulle 3 linee in alto a sinistra ed accedi alla voce "Lavagna".\n',
'INFO_LINK_DA_CONDIVIDERE': 'Link da condividere ai tuoi invitati per farli registrare al sito di Ayni:\n%s\n\nLink da condividere per partecipare allo Zoom (Conferenza OnLine):\n%s',
'ZOOM_CONFERENCE': 'Qui trovi le date di programmazione agli Zoom:',
'EMAIL_VERIF': "Email Verificata",
"NON_VERIF": "Non Verificata",
"VERIF": "Verificata",
'EMAIL': "Email",
'BOT': "AYNI BOT",
'EMAIL_NON_VERIF': "Email Non Verificata\nleggi la tua casella email e trova **\"Confermare la Registrazione a Ayni\"**<br>e clicca sul bottone **\"Verifica Registrazione\"**",
'TELEGRAM_NOT_CONNECTED': "Telegram non associato al tuo account!",
'NESSUN_INVITATO': 'Non hai invitato nessuno',
@@ -82,18 +107,33 @@ textlang = {
'LINEE_GUIDA': 'Accettato le Linee Guida',
'VIDEO_INTRO': 'Visto il Video di AYNI',
'SCRITTO_SOGNO': 'Hai scritto il tuo Sogno',
'PAYMENTS': 'Modalità di Pagamento',
'INVITATI': 'persone registrate che hai invitato',
'INVITATI_ATTIVI': 'Invitati con i 7 Requisiti',
'NONREG': 'Invitati non Registrati',
'CLICCA_PER_ZOOM': 'AL GIORNO E ORA INDICATA, PER ENTRARE NELLA VIDEO-CONFERENZA, CLICCA QUI',
'CLICCA_ENTRA': 'CLICCA QUI PER ENTRARE !',
'ZOOM_INIZIATO': 'QUESTA CONFERENZA E\' INIZIATA!',
'SCEGLI_VOCE': 'scegli una voce:',
'INVITATI_LISTA': 'I Tuoi Invitati (in verde con almeno i primi 7 Requisiti)',
},
us: {
"partecipanti": "participants",
'TESTO_ASSISTENZA': "Per entrare nel Sito AYNI:\nhttps://ayni.gifteconomy.app\n\nHai dimenticato la Password per accedere al sito?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\nChat AYNI BOT (questa):\nhttps://t.me/notevoleaynibot\n\nChat AYNI-BiblioBacheca: https://t.me/joinchat/AL2qKExZKvenLgpVhOyefQ \n\nChat di Aiuto e Supporto: 'AYNI Help & Support'\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n1 - Fai la tua domanda e chiedi assistenza.\n2 - Dopo aver ricevuto aiuto esci dalla chat.\nPotrai rientrare ogni qualvolta ne avrai la necessità.",
'TESTO_ASSISTENZA': "Per entrare nel Sito AYNI:\nhttps://ayni.gifteconomy.app\n\nHai dimenticato la Password per accedere al sito?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\nChat AYNI BOT (questa):\nhttps://t.me/notevoleaynibot\n\nChat AYNI - EMPOWER: Entra ⛩ nella nostra Community chat:\n https://t.me/joinchat/C741mkx5QYXu-kyYCYvA8g\n\nChat AYNI-BIBLIO: https://t.me/joinchat/AL2qKExZKvenLgpVhOyefQ \n\nChat di Aiuto e Supporto: 'AYNI - HELP'\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n1 - Fai la tua domanda e chiedi assistenza.\n2 - Dopo aver ricevuto aiuto esci dalla chat.\nPotrai rientrare ogni qualvolta ne avrai la necessità.",
'BENVENUTO': "Benvenuto",
'INFO_LA_MIA_LAVAGNA': 'In questa sezione puoi controllare se hai completato la lista dei requisiti per entrare in programmazione Bigliettera:\n',
'INFO_LAVAGNA_SITO': 'Per accedere al menu completo vai sul sito %s, clicca sulle 3 linee in alto a sinistra ed accedi alla voce "La tua Lavagna".\n',
'HAI_I_7_REQUISITI': 'PRIMI PASSI OK!\nHai i Primi 7 Requisiti per Entrare in programmazione!',
'NON_HAI_I_7_REQUISITI': 'Attenzione!\nAncora non hai i 7 Requisiti per Entrare in programmazione!',
'HAI_I_9_REQUISITI': 'COMPLIMENTI!\nHai TUTTI i 9 Requisiti per poter effettuare e poi ricevere il tuo Dono!',
'NON_HAI_I_9_REQUISITI': 'Attenzione!\nAncora non hai Tutti i 9 Requisiti per poter effettuare e poi ricevere il tuo Dono!',
'INFO_LA_MIA_LAVAGNA': '✨ Lista dei Requisiti: ✨ \n',
'INFO_LAVAGNA_SITO_COMPLETARE': 'Per completare tutti i requisiti vai sul sito:\n%s\nPer vedere lo stato dei tuoi invitati, clicca sulle 3 linee in alto a sinistra ed accedi alla voce "Lavagna".\n',
'INFO_LAVAGNA_SITO': 'Per vedere lo stato dei tuoi invitati, sul sito AYNI, clicca sulle 3 linee in alto a sinistra ed accedi alla voce "Lavagna".\n',
'INFO_LINK_DA_CONDIVIDERE': 'Link da condividere ai tuoi invitati per farli registrare al sito di Ayni:\n%s\n\nLink da condividere per partecipare allo Zoom (Conferenza OnLine):\n%s',
'ZOOM_CONFERENCE': 'Qui trovi le date di programmazione agli Zoom:',
'EMAIL_VERIF': "Email Verificata",
"NON_VERIF": "Non Verificata",
"VERIF": "Verificata",
'EMAIL': "Email",
'BOT': "AYNI BOT",
'EMAIL_NON_VERIF': "Email Non Verificata\nleggi la tua casella email e trova **\"Confermare la Registrazione a Ayni\"**<br>e clicca sul bottone **\"Verifica Registrazione\"**",
'TELEGRAM_NOT_CONNECTED': "Telegram non associato al tuo account!",
'NESSUN_INVITATO': 'Non hai invitato nessuno',
@@ -101,17 +141,27 @@ textlang = {
'LINEE_GUIDA': 'Accettato le Linee Guida',
'VIDEO_INTRO': 'Visto il Video di AYNI',
'SCRITTO_SOGNO': 'Hai scritto il tuo Sogno',
'PAYMENTS': 'Modalità di Pagamento',
'INVITATI': 'persone registrate che hai invitato',
'INVITATI_ATTIVI': 'Invitati con i 7 Requisiti',
'NONREG': 'Invitati non Registrati',
'CLICCA_PER_ZOOM': 'AL GIORNO E ORA INDICATA, PER ENTRARE NELLA VIDEO-CONFERENZA, CLICCA QUI',
'CLICCA_ENTRA': 'CLICCA QUI PER ENTRARE !',
'ZOOM_INIZIATO': 'QUESTA CONFERENZA E\' INIZIATA!',
'SCEGLI_VOCE': 'scegli una voce:',
'INVITATI_LISTA': 'I Tuoi Invitati (in verde con almeno i primi 7 Requisiti)',
}
};
module.exports = {
INITDB_FIRSTIME: true,
ACAPO: '\n',
LANGADMIN: 'it',
AYNI: '7',
APORTADOR_NONE: '------',
TYPE_PROJECT: 1,
@@ -602,6 +652,8 @@ module.exports = {
$exists: false
}
});
if (params.filterand.includes(shared_consts.FILTER_USER_TELEGRAM_BLOCKED))
filtriadded.push({ 'profile.teleg_id_old': { $gt: 1 } });
}
@@ -720,7 +772,7 @@ module.exports = {
return myval
},
snooze(ms) {
async snooze(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
},
@@ -830,6 +882,30 @@ module.exports = {
StrToBool(mystr) {
return (mystr === '-1') ? true : false
},
writelogfile(mystr, filename) {
// fs.appendFile(FILELOG, mystr, function (err) {
// if (err) throw err;
// console.log('Saved!');
// });
const stream = fs.createWriteStream(filename, {flags:'a'});
stream.write(mystr);
stream.end();
},
writelog(mystr) {
this.writelogfile(mystr, FILELOG);
},
writeEventsLog(mystr) {
this.writelogfile(mystr, FILEEVENTS);
},
writeBilletteraLog(mystr) {
this.writelogfile(mystr, FILEBILLETTERA);
},
move(oldPath, newPath, callback) {
fs.rename(oldPath, newPath, function (err) {

View File

@@ -17,6 +17,7 @@ module.exports = {
FILTER_USER_NO_EMAIL_VERIFICATA: 128,
FILTER_USER_NO_DREAM: 256,
FILTER_EXTRALIST_DELETED: 512,
FILTER_USER_TELEGRAM_BLOCKED: 1024,
Permissions: {
Admin: 1,
@@ -30,7 +31,7 @@ module.exports = {
},
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', 'numinvitati', 'numinvitatiattivi']
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', 'qualified']
}
};