first commit
This commit is contained in:
@@ -0,0 +1,187 @@
|
||||
'use strict';
|
||||
|
||||
const request = require('request');
|
||||
const db = require('../app/db')
|
||||
const logger = require('../app/logger');
|
||||
|
||||
var wallets = {
|
||||
getuserwallet: function (req, res, next) {
|
||||
logger.info("getuserwallet: function (req, res, next)");
|
||||
//console.log("REQ---->",req.body.uid);
|
||||
logger.info(req.query);
|
||||
var data = {
|
||||
"uid": req.query.uid,
|
||||
"member_id": req.query.member_id,
|
||||
"sessionid": req.query.sessionid,
|
||||
};
|
||||
let Qstring = "";
|
||||
Qstring = "SELECT w.amount,c.*,w.amount AS current_balance,c.country,c.banner, m.country AS owner_country, " +
|
||||
" w.transfer_limit,w.uid AS wallet_uid, 0 AS escrow,w.brand,w.card_last4 " +
|
||||
"FROM members_wallet w " +
|
||||
"LEFT JOIN currency c ON c.code=w.currency " +
|
||||
"LEFT JOIN members m ON m.id = w.member_id " +
|
||||
"WHERE w.member_id = " + data.member_id +
|
||||
" AND m.uid='" + data.uid + "' ORDER BY c.lorder DESC ";
|
||||
logger.info(Qstring);
|
||||
db.query(Qstring, function (err, result) {
|
||||
try {
|
||||
if (err) throw err;
|
||||
let resultItem = {
|
||||
"result": result.rows,
|
||||
"total_record": result.rowCount
|
||||
}
|
||||
next(null, resultItem); // pass control to the next handler
|
||||
} catch (e) {
|
||||
next(e.message, null); // pass control to the next handler
|
||||
}
|
||||
});
|
||||
},
|
||||
siteSettings: function (req, res, next) {
|
||||
logger.info("siteSettings: function (req, res, next)");
|
||||
let Qstring = "";
|
||||
Qstring = "SELECT * FROM settings";
|
||||
logger.info(Qstring);
|
||||
db.query(Qstring, function (err, result) {
|
||||
try {
|
||||
if (err) throw err;
|
||||
let resultItem = {
|
||||
"result": result.rows,
|
||||
"total_record": result.rowCount
|
||||
}
|
||||
next(null, resultItem); // pass control to the next handler
|
||||
} catch (e) {
|
||||
next(e.message, null); // pass control to the next handler
|
||||
}
|
||||
});
|
||||
},
|
||||
getuserkidswallet: function (req, res, next) {
|
||||
logger.info("getuserkidswallet: function (req, res, next)");
|
||||
//console.log("REQ---->",req.body.uid);
|
||||
logger.info(req.query);
|
||||
var data = {
|
||||
"uid": req.query.uid,
|
||||
"member_id": req.query.member_id,
|
||||
"family_uid": req.query.family_uid,
|
||||
"sessionid": req.query.sessionid,
|
||||
};
|
||||
let Qstring = "";
|
||||
Qstring = " SELECT w.amount,c.*,w.amount AS current_balance,c.country, " +
|
||||
"w.transfer_limit,w.uid AS wallet_uid, 0 AS escrow ,w.brand,w.card_last4 " +
|
||||
"FROM members_wallet w " +
|
||||
"LEFT JOIN members_family f ON w.member_id = f.family_member_id " +
|
||||
"LEFT JOIN currency c ON c.code=w.currency " +
|
||||
" LEFT JOIN members m ON m.id = f.member_id " +
|
||||
"WHERE f.uid = '" + data.family_uid + "' " +
|
||||
"AND f.member_id = " + data.member_id +
|
||||
" AND m.uid='" + data.uid + "' ORDER BY c.lorder DESC ";
|
||||
logger.info(Qstring);
|
||||
db.query(Qstring, function (err, result) {
|
||||
try {
|
||||
if (err) throw err;
|
||||
let resultItem = {
|
||||
"result": result.rows,
|
||||
"total_record": result.rowCount
|
||||
}
|
||||
next(null, resultItem); // pass control to the next handler
|
||||
} catch (e) {
|
||||
next(e.message, null); // pass control to the next handler
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
},
|
||||
getescrows: function (req, res, next) {
|
||||
logger.info("getescrows: function (req, res, next)");
|
||||
var result = [];
|
||||
|
||||
// this.RecoCheckOffers(req, res, function (err, result) {
|
||||
|
||||
var data = {
|
||||
"uid": req.body.uid,
|
||||
"member_id": req.body.member_id,
|
||||
"sessionid": req.body.sessionid,
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
var data = {
|
||||
"uid": req.body.uid,
|
||||
"member_id": req.body.member_id,
|
||||
"sessionid": req.body.sessionid,
|
||||
};
|
||||
let Qstring = "SELECT sum(amount) AS escrow,currency " +
|
||||
" FROM members_payments "+
|
||||
" WHERE code ='OFDPS' AND member_id = " + data.member_id +
|
||||
" AND confirmation IS NOT NULL "+
|
||||
" AND flags = 4 GROUP BY currency";
|
||||
logger.info(Qstring);
|
||||
db.query(Qstring, function (err, result) {
|
||||
try {
|
||||
if (err) throw err;
|
||||
let resultItem = {
|
||||
"result": result.rows,
|
||||
"total_record": result.rowCount
|
||||
}
|
||||
next(null, resultItem); // pass control to the next handler
|
||||
} catch (e) {
|
||||
next(e.message, null); // pass control to the next handler
|
||||
}
|
||||
|
||||
});
|
||||
// });
|
||||
|
||||
},
|
||||
RecoCheckOffers: function (req, res, next) {
|
||||
logger.info("RecoCheckOffers: function (req, res, next)");
|
||||
let Qstring = "SELECT * FROM members_jobs_offer WHERE expire > now() " +
|
||||
"AND status = 1 AND client_id > 0 AND client_id =" + req.body.member_id;
|
||||
logger.info(Qstring);
|
||||
db.query(Qstring, function (err, result) {
|
||||
try {
|
||||
if (err) throw err;
|
||||
let resultItem = {
|
||||
"result":
|
||||
[
|
||||
{
|
||||
"title": "Share RecoCheckOffers with a friend.",
|
||||
"contract": null,
|
||||
"card_type": "INVITE",
|
||||
"card_style": null,
|
||||
"description": "Show WrenchBoard to a friend and earn free coupons. Get started.",
|
||||
"blog_id": "0",
|
||||
"card_icon": "icon1",
|
||||
"offer_id": "0",
|
||||
"banner": "banner-refer.jpg",
|
||||
"banner_location": "LOCAL",
|
||||
"link_path": "referral",
|
||||
"button_text": "Continue",
|
||||
"short_button_text": "View now",
|
||||
"short_title": "Invite a Friend - get Rewards",
|
||||
"short_description": "Share WrenchBoard with a friend.",
|
||||
"short_style": "short_style by"
|
||||
}
|
||||
]
|
||||
|
||||
,
|
||||
"total_record": result.rowCount
|
||||
};
|
||||
logger.info(result);
|
||||
next(null, resultItem); // pass control to the next handler
|
||||
} catch (e) {
|
||||
next(e.message, null); // pass control to the next handler
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
RecoCheckFamilyLogin: function (req, res, next) { },
|
||||
// RecoCheckFamilyCount: function (req, res, next) { },
|
||||
RecoCheckFamilyCount: function (req, res, next) { },
|
||||
RecoCheckCoupons: function (req, res, next) { },
|
||||
RecoCheckTaskDue: function (req, res, next) { },
|
||||
RecoCheckTaskReview: function (req, res, next) { },
|
||||
RecoCheckBlog: function (req, res, next) { },
|
||||
RecoOffersInterest: function (req, res, next) { },
|
||||
RecoReferAFreind: function (req, res, next) { },
|
||||
RecoPendingInterestCount: function (req, res, next) { }
|
||||
};
|
||||
module.exports = wallets;
|
||||
Reference in New Issue
Block a user