Added actions

This commit is contained in:
CHIEFSOFT\ameye
2024-12-21 12:53:26 -05:00
parent d77f15dce7
commit 3f8222064f
3 changed files with 140 additions and 2 deletions
+7
View File
@@ -4,10 +4,17 @@ const properties = require('../package.json')
const redeem = require('../service/redeem');
const wallets = require('../service/wallets');
const ebroker = require('../service/ebroker');
const members_action = require('../service/members_action');
const logger = require('../app/logger');
var controllers = {
refreshMemberActions: function(req, res) {
members_action.refreshActions(req, res, function(err, result) {
res.status(200).json({'status': 'OK', 'internal_return': 0, 'result_list': result.result,'total_record': result.total_record })
});
},
getFamilyBanners: function(req, res) {
redeem.getredeemoptions(req, res, function(err, result) {
res.status(200).json({'status': 'OK', 'internal_return': 0, 'result_list': result.result,'total_record': result.total_record })
+2 -2
View File
@@ -3,8 +3,8 @@
const controller = require('./controller');
module.exports = function(app) {
app.route('/redeemoptions')
.get(controller.getFamilyBanners);
app.route('/proc/refreshActions')
.get(controller.refreshMemberActions);
app.route('/getwallets')
.get(controller.getUsersWallets);
+131
View File
@@ -0,0 +1,131 @@
'use strict';
const request = require('request');
const db = require('../app/db')
const logger = require('../app/logger');
var members_action = {
refreshActions: function (req, res, next) {
//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;
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"
},
}
};
let resultItem ={
"result": bannerArray,
"total_record": 4
}
next(null, resultItem ); // pass control to the next handler
},
};
module.exports = members_action;