fix: non riuscivi ad acquistare i RIS al gruppo
- lista linkREG
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
DATABASE=test_PiuCheBuono
|
DATABASE=test_FreePlanet
|
||||||
UDB=paofreeplanet
|
UDB=paofreeplanet
|
||||||
PDB=mypassword@1A
|
PDB=mypassword@1A
|
||||||
SEND_EMAIL=0
|
SEND_EMAIL=0
|
||||||
SEND_EMAIL_ORDERS=1
|
SEND_EMAIL_ORDERS=1
|
||||||
PORT=3000
|
PORT=3000
|
||||||
appTelegram_TEST=["1","17"]
|
appTelegram_TEST=["1","13"]
|
||||||
appTelegram=["1","17"]
|
appTelegram=["1","13"]
|
||||||
appTelegram_DEVELOP=["17"]
|
appTelegram_DEVELOP=["13"]
|
||||||
DOMAIN=mongodb://localhost:27017/
|
DOMAIN=mongodb://localhost:27017/
|
||||||
AUTH_MONGODB=0
|
AUTH_MONGODB=0
|
||||||
ENABLE_PUSHNOTIFICATION=1
|
ENABLE_PUSHNOTIFICATION=1
|
||||||
@@ -29,7 +29,7 @@ GCM_API_KEY=""
|
|||||||
PROD=0
|
PROD=0
|
||||||
PROJECT_DESCR_MAIN='__PROJECTS'
|
PROJECT_DESCR_MAIN='__PROJECTS'
|
||||||
SECRK=Askb38v23jjDFaoskBOWj92axXCQ
|
SECRK=Askb38v23jjDFaoskBOWj92axXCQ
|
||||||
TOKEN_LIFE=2h
|
TOKEN_LIFE=1m
|
||||||
REFRESH_TOKEN_LIFE=14d
|
REFRESH_TOKEN_LIFE=14d
|
||||||
FTPSERVER_HOST=139.162.166.31
|
FTPSERVER_HOST=139.162.166.31
|
||||||
FTPSERVER_PORT=21
|
FTPSERVER_PORT=21
|
||||||
@@ -38,9 +38,4 @@ FTPSERVER_PWD=ftpmypwd@1A_
|
|||||||
AUTH_NEW_SITES=123123123
|
AUTH_NEW_SITES=123123123
|
||||||
SCRIPTS_DIR=admin_scripts
|
SCRIPTS_DIR=admin_scripts
|
||||||
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
||||||
MIAB_HOST=box.lamiaposta.org
|
|
||||||
MIAB_ADMIN_EMAIL=admin@lamiaposta.org
|
|
||||||
MIAB_ADMIN_PASSWORD=passpao1pabox@1A
|
|
||||||
DS_API_KEY="sk-222e3addb3d8455d8b0516d93906eec7"
|
DS_API_KEY="sk-222e3addb3d8455d8b0516d93906eec7"
|
||||||
API_KEY_MSSQL="m68yADSr123MIVIDA@154$DSAGVOK"
|
|
||||||
SERVER_A_URL="http://51.77.156.69:3000"
|
|
||||||
@@ -479,3 +479,8 @@ Gio 13/03 ORE 18:57: [<b>Circuito RIS Italia</b>]: Inviate Monete da surya1977 a
|
|||||||
Saldi:
|
Saldi:
|
||||||
surya1977: 11.00 RIS]
|
surya1977: 11.00 RIS]
|
||||||
GruppoYurta: 17.00 RIS]
|
GruppoYurta: 17.00 RIS]
|
||||||
|
Dom 23/03 ORE 22:24: [<b>Circuito RIS Italia</b>]: Inviate Monete da surya1977 a GruppoYurta 1 RIS [causale: ]
|
||||||
|
|
||||||
|
Saldi:
|
||||||
|
surya1977: 88.20 RIS]
|
||||||
|
GruppoYurta: 6.00 RIS]
|
||||||
@@ -55,6 +55,7 @@ const StatSchema = new Schema({
|
|||||||
diffusorilist: [],
|
diffusorilist: [],
|
||||||
receiveRislist: [],
|
receiveRislist: [],
|
||||||
receiveRislistgroup: [],
|
receiveRislistgroup: [],
|
||||||
|
listlinksreg: [],
|
||||||
strettelist: [],
|
strettelist: [],
|
||||||
num_transaz_tot: Number,
|
num_transaz_tot: Number,
|
||||||
tot_RIS_transati: Number,
|
tot_RIS_transati: Number,
|
||||||
@@ -95,6 +96,7 @@ StatSchema.statics.calculateStats = async function (idapp) {
|
|||||||
lastsonline: await User.getLastOnlineUsers(idapp),
|
lastsonline: await User.getLastOnlineUsers(idapp),
|
||||||
lastssharedlink: await User.getLastSharedLink(idapp),
|
lastssharedlink: await User.getLastSharedLink(idapp),
|
||||||
diffusorilist: await User.getDiffusoriUsers(idapp),
|
diffusorilist: await User.getDiffusoriUsers(idapp),
|
||||||
|
listlinksreg: await User.getListLinkReg(idapp),
|
||||||
receiveRislist: await User.getReceiveRISUsers(idapp),
|
receiveRislist: await User.getReceiveRISUsers(idapp),
|
||||||
receiveRislistgroup: await MyGroup.getReceiveRISGroups(idapp),
|
receiveRislistgroup: await MyGroup.getReceiveRISGroups(idapp),
|
||||||
strettelist: await User.getLastStretteDiManoUsers(idapp),
|
strettelist: await User.getLastStretteDiManoUsers(idapp),
|
||||||
|
|||||||
@@ -435,6 +435,9 @@ const UserSchema = new mongoose.Schema({
|
|||||||
lastdate_reqRis: {
|
lastdate_reqRis: {
|
||||||
type: Date,
|
type: Date,
|
||||||
},
|
},
|
||||||
|
lastdate_LinkReg: {
|
||||||
|
type: Date,
|
||||||
|
},
|
||||||
notifs: [
|
notifs: [
|
||||||
{
|
{
|
||||||
_id: false,
|
_id: false,
|
||||||
@@ -4878,6 +4881,15 @@ UserSchema.statics.getReceiveRISUsers = async function (idapp) {
|
|||||||
return ris;
|
return ris;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
UserSchema.statics.getListLinkReg = async function (idapp) {
|
||||||
|
const User = this;
|
||||||
|
|
||||||
|
return await User.aggregate(User.getQueryListLinkReg(idapp, 8)).then(ris => {
|
||||||
|
// console.table(ris);
|
||||||
|
return ris;
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
UserSchema.statics.checkUser = async function (idapp, username) {
|
UserSchema.statics.checkUser = async function (idapp, username) {
|
||||||
@@ -5423,6 +5435,93 @@ UserSchema.statics.getQueryReceiveRISUsers = function (idapp, hours) {
|
|||||||
return query;
|
return query;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
UserSchema.statics.getQueryListLinkReg = function (idapp, hours) {
|
||||||
|
|
||||||
|
const query = [
|
||||||
|
{
|
||||||
|
$match: {
|
||||||
|
idapp,
|
||||||
|
'profile.lastdate_LinkReg': { $gte: tools.IncDateNow(-(1000 * 60 * 60 * hours)) },
|
||||||
|
$or: [
|
||||||
|
{ deleted: { $exists: false } },
|
||||||
|
{ deleted: { $exists: true, $eq: false } }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$group:
|
||||||
|
{
|
||||||
|
_id: "$username",
|
||||||
|
count: {
|
||||||
|
$sum: 1,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ $sort: { 'profile.lastdate_linkReg': -1 } },
|
||||||
|
{ $limit: 30 },
|
||||||
|
{
|
||||||
|
$lookup: {
|
||||||
|
from: "users",
|
||||||
|
let: {
|
||||||
|
username: "$_id",
|
||||||
|
idapp,
|
||||||
|
},
|
||||||
|
pipeline: [
|
||||||
|
{
|
||||||
|
$match: {
|
||||||
|
$expr: {
|
||||||
|
$and: [
|
||||||
|
{
|
||||||
|
$eq: [
|
||||||
|
"$$username",
|
||||||
|
"$username",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$eq: [
|
||||||
|
"$$idapp",
|
||||||
|
"$idapp",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
as: "user",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ $unwind: "$user" },
|
||||||
|
{
|
||||||
|
$replaceRoot: {
|
||||||
|
newRoot: {
|
||||||
|
$mergeObjects: ["$user", "$$ROOT"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$project: {
|
||||||
|
_id: 0,
|
||||||
|
count: 1,
|
||||||
|
aportador_solidario: 1,
|
||||||
|
username: 1,
|
||||||
|
name: 1,
|
||||||
|
surname: 1,
|
||||||
|
lasttimeonline: 1,
|
||||||
|
'profile.lastdate_linkReg': 1,
|
||||||
|
'profile.mycircuits': 1,
|
||||||
|
date_reg: 1,
|
||||||
|
idapp: 1,
|
||||||
|
"profile.img": 1,
|
||||||
|
'profile.handshake': 1,
|
||||||
|
'profile.note': 1,
|
||||||
|
'profile.da_contattare': 1,
|
||||||
|
perm: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
return query;
|
||||||
|
};
|
||||||
|
|
||||||
UserSchema.statics.getUsersRegWeekly = function (idapp, nrec) {
|
UserSchema.statics.getUsersRegWeekly = function (idapp, nrec) {
|
||||||
|
|
||||||
const query = [
|
const query = [
|
||||||
@@ -6220,6 +6319,17 @@ UserSchema.statics.setReceiveRis = async function (idapp, username) {
|
|||||||
return !!record;
|
return !!record;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
UserSchema.statics.setLinkReg = async function (idapp, username) {
|
||||||
|
const User = this;
|
||||||
|
|
||||||
|
return await User.findOneAndUpdate({
|
||||||
|
idapp, username,
|
||||||
|
},
|
||||||
|
{ $set: { 'profile.lastdate_LinkReg': new Date() } }, { new: false }).lean().then((record) => {
|
||||||
|
return !!record;
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
UserSchema.statics.addNewSite = async function (idappPass, body) {
|
UserSchema.statics.addNewSite = async function (idappPass, body) {
|
||||||
|
|||||||
@@ -496,6 +496,28 @@ router.post('/receiveris', authenticate, (req, res) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.post('/listlinkreg', authenticate, (req, res) => {
|
||||||
|
const username = req.user ? req.user.username : '';
|
||||||
|
const groupname = req.body.groupname;
|
||||||
|
const idapp = req.body.idapp;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!username)
|
||||||
|
return res.send({ code: server_constants.RIS_CODE_ERR });
|
||||||
|
|
||||||
|
return User.setLinkReg(idapp, username)
|
||||||
|
.then(risult => {
|
||||||
|
res.send({ code: server_constants.RIS_CODE_OK });
|
||||||
|
}).catch((err) => {
|
||||||
|
tools.mylog('ERRORE IN listlinkreg: ' + err.message);
|
||||||
|
res.status(400).send();
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
res.status(400).send();
|
||||||
|
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
router.post('/profile', authenticate, (req, res) => {
|
router.post('/profile', authenticate, (req, res) => {
|
||||||
const usernameOrig = req.user ? req.user.username : '';
|
const usernameOrig = req.user ? req.user.username : '';
|
||||||
const perm = req.user ? req.user.perm : tools.Perm.PERM_NONE;
|
const perm = req.user ? req.user.perm : tools.Perm.PERM_NONE;
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.2.28
|
1.2.29
|
||||||
Reference in New Issue
Block a user