From fe5d2c01ac0a94e045045e27eea8edd183369e54 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Mon, 25 Mar 2024 14:57:55 -0400 Subject: [PATCH] common media --- api/controller.js | 2 +- service/resourcecategory.js | 77 +++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/api/controller.js b/api/controller.js index 8414533..cb9e408 100644 --- a/api/controller.js +++ b/api/controller.js @@ -23,7 +23,7 @@ var controllers = { }, getCommonMedia: function(req, res) { //homebanners - resourcecategory.homebanners(req, res, function(err, dist) { + resourcecategory.commonmedia(req, res, function(err, dist) { if (err) { res.send(err); } diff --git a/service/resourcecategory.js b/service/resourcecategory.js index 48c5528..377266c 100644 --- a/service/resourcecategory.js +++ b/service/resourcecategory.js @@ -132,6 +132,83 @@ var resourcecategory = { } next(null, resultItem ); // pass control to the next handler + }, + commonmedia: function (req, res, next) { + var result=[]; +//common_media + + 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 * FROM common_media"; // "SELECT uid,id,username FROM members LIMIT 10"; + + // logger.info(Qstring); + 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 + // next(null, result.rows); // pass control to the next handler + } catch (e) { + next(e.message, null); // pass control to the next handler + } + }); + + + var result_list =[ + { + "title": "Some family accounts are yet to log in.", + "contract": null, + "card_type": "FAMILY_NOLOGIN", + "card_style": null, + "description": "Some family members have not logged in - a little nudge might help.", + "blog_id": "0", + "card_icon": "icon1", + "offer_id": "0", + "banner": "https://www.wrenchboard.com/assets/images/apps/banners/family-login.jpg", + "banner_location": "URL", + "link_path": "acc-family", + "button_text": "Continue", + "short_button_text": "View Now", + "short_title": "Some family accounts are yet to log in", + "short_description": "Help your family member get started.", + "short_style": "short_style" + }, + + { + "title": "Share WrenchBoard 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" + } + ]; + + // let resultItem ={ + // "result": result_list, + // "total_record": 5 + // } + // next(null, resultItem ); // pass control to the next handler + }, homebanners: function (req, res, next) { var result=[];