From 98a275ba3d74a9e69b0b9bf0cb0637a863bd5670 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sat, 21 Dec 2024 13:17:04 -0500 Subject: [PATCH] ran query --- service/members_action.js | 129 ++++++-------------------------------- 1 file changed, 19 insertions(+), 110 deletions(-) diff --git a/service/members_action.js b/service/members_action.js index 78d30c0..32dc1ae 100644 --- a/service/members_action.js +++ b/service/members_action.js @@ -7,125 +7,34 @@ const logger = require('../app/logger'); var members_action = { refreshActions: function (req, res, next) { logger.info(req.query); - //console.log("REQ---->",req.body.uid); - var data = { - "uid": req.body.uid, - "member_id": req.body.member_id, - "limit": (req.body.limit != null && req.body.limit !== "") ? req.body.limit : 20, - "sessionid": req.body.sessionid, - "page": req.body.page - }; - let Qstring =""; // "SELECT uid,id,username FROM members LIMIT 10"; - let QextraString =""; - if ( req.body.uid != null && req.body.uid !== ""){ - QextraString= " AND j.country IN (SELECT c.country FROM members_wallet w " + - " LEFT JOIN currency c ON c.code =w.currency " + - " LEFT JOIN members m ON m.id = w.member_id " + - " WHERE m.uid = '"+req.body.uid+"' )"; - } - Qstring = " SELECT j.title,j.description,m.id AS job_id,m.expire,m.job_description,j.price, " + - " m.offer_code,j.timeline_days, to_char(m.expire, 'Dy Mon dd, yyyy HH:MI AM') AS expire2," + - " m.uid AS offer_uid,j.uid AS job_uid,m.added::date AS offer_added,j.country AS job_country, " + - " c.code AS currency_code, c.description AS currency_description,j.country, j.category " + - " FROM members_jobs_offer m " + - " LEFT JOIN members_jobs j ON j.id=m.job_id " + - " LEFT JOIN currency c ON c.country=j.country " + - " WHERE m.status = 1 AND m.client_id=0 " + - " AND m.expire IS NOT NULL " + - " AND m.public_view = 1 AND m.expire> now() AND j.status = 1 " + QextraString + - " ORDER BY m.expire DESC LIMIT "+ data.limit; + let Qstring = "SELECT id,uid,updated from members ORDER BY updated ASC LIMIT 2"; logger.info( Qstring ); - var bannerArray = { - "thiskey01": { - "banner": { - "image": "https://www.wrenchboard.com/assets/images/apps/banners/redeem/rex-card.jpg", - "icon": "bannerimage.icon", - "style": "style1", - "text": "This is the title text?", - "description": "Some description of this item, ", - "action": "thiskey" - }, - }, - "thiskey02": { - "banner": { - "image": "https://www.wrenchboard.com/assets/images/apps/banners/redeem/rex-amazon.jpg", - "icon": "bannerimage.icon", - "style": "style1", - "text": "Send your balance to Amazon Digital Card", - "description": "Some descriptio.n of this item, ", - "action": "thiskey" - }, - }, - "thiskey03": { - "banner": { - "image": "https://www.wrenchboard.com/assets/images/apps/banners/redeem/rex-apple.jpg", - "icon": "bannerimage.icon", - "style": "style1", - "text": "This is the title text?", - "description": "Some description of this item, ", - "action": "thiskey" - }, - }, - "thiskey04": { - "banner": { - "image": "https://www.wrenchboard.com/assets/images/apps/banners/redeem/rex-plays.jpg", - "icon": "bannerimage.icon", - "style": "style1", - "text": "This is the title text?", - "description": "Some description of this item, ", - "action": "thiskey" - }, - }, - "thiskey05": { - "banner": { - "image": "https://www.wrenchboard.com/assets/images/apps/banners/redeem/rex-xbox.jpg", - "icon": "bannerimage.icon", - "style": "style1", - "text": "This is the title text?", - "description": "Some description of this item, ", - "action": "thiskey" - }, - }, - "thiskey06": { - "banner": { - "image": "https://www.wrenchboard.com/assets/images/apps/banners/kids/banner-start.jpg", - "icon": "bannerimage.icon", - "style": "style1", - "text": "This is the title text?", - "description": "Some description of this item, ", - "action": "thiskey" - }, - }, - "thiskey07": { - "banner": { - "image": "https://www.wrenchboard.com/assets/images/apps/banners/kids/banner-start.jpg", - "icon": "bannerimage.icon", - "style": "style1", - "text": "This is the title text?", - "description": "Some description of this item, ", - "action": "thiskey" - }, - }, - "thiskey08": { - "banner": { - "image": "https://www.wrenchboard.com/assets/images/apps/banners/kids/banner-start.jpg", - "icon": "bannerimage.icon", - "style": "style1", - "text": "This is the title text?", - "description": "Some description of this item, ", - "action": "thiskey" - }, + db.query(Qstring, function (err, result) { + try { + if (err) throw err; + + + + + let resultItem ={ + "result": result.rows, + "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 } - }; + }); + let resultItem ={ - "result": bannerArray, + "result": [], "total_record": 4 } next(null, resultItem ); // pass control to the next handler - }, }; module.exports = members_action;