From 098c1281a828a09b3916cf63abc28681a1ce9e88 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Wed, 11 Sep 2024 23:07:20 -0400 Subject: [PATCH] reco engine --- wrenchboard/src/shared_tool/reco_egine.cc | 68 +++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/wrenchboard/src/shared_tool/reco_egine.cc b/wrenchboard/src/shared_tool/reco_egine.cc index 5dc5760b..7a9a34c7 100644 --- a/wrenchboard/src/shared_tool/reco_egine.cc +++ b/wrenchboard/src/shared_tool/reco_egine.cc @@ -39,6 +39,8 @@ long RecoCheckBlog( int itm_count, CVars in, CVars &out ); long RecoOffersInterest( int itm_count, CVars in, CVars &out ); long RecoReferAFreind(int itm_count, CVars in, CVars &out ); long RecoPendingInterestCount( int itm_count, CVars in, CVars &out ); +long RecoStartMarketCard( int itm_count, CVars in, CVars &out ); + long recommendation_engine(long action , CVars in, CVars &out) { try{ @@ -77,6 +79,8 @@ long WrenchFamilyHomeBanners(CVars in, CVars &out){ return 0; } +//long RecoStartMarketCard( int itm_count, CVars in, CVars &out ); + // also used from accounts long WrenchHomeBanners(CVars in, CVars &out) { out["status"] = "long WrenchHomeBanners(CVars in, CVars &out)"; @@ -85,6 +89,7 @@ long WrenchHomeBanners(CVars in, CVars &out) { char vname[30]; long member_id = REQ_LONG(in, "member_id", 1, -1); int itm_count= 0; + if( RecoStartMarketCard( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } if( RecoCheckOffers( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } if( RecoPendingInterestCount( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } if( RecoCheckFamilyLogin( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } @@ -215,6 +220,69 @@ long RecoOffersInterest(int itm_count, CVars in, CVars &out ){ return ret; } +long RecoStartMarketCard( int itm_count, CVars in, CVars &out ){ + logfmt(logINFO, "RecoCheckOffers()"); + long ret = PHP_API_BAD_PARAM; + const PGresult *res; + char vname[30]; + try { + int ic = itm_count; + long member_id = REQ_LONG(in, "member_id", 1, -1); + res = pgsql_query("SELECT * FROM members WHERE uid::text = '%s' AND added::date > now() - interval '3000 minutes' ", in["uuid"].c_str()); + if (res != NULL && pgsql_num_rows(res) > 0) { + + snprintf(vname, sizeof (vname), "title_%05d", ic); + out[vname] = "Find new task in the market."; + + snprintf(vname, sizeof (vname), "description_%05d", ic); + out[vname] = "You have received some offers. View, accept, or reject before the offer(s) expire."; + + snprintf(vname, sizeof (vname), "card_type_%05d", ic); + out[vname] = "OFFERS"; + + snprintf(vname, sizeof (vname), "offer_id_%05d", ic); + out[vname] = "0"; + + snprintf(vname, sizeof (vname), "blog_id_%05d", ic); + out[vname] = "0"; + + snprintf(vname, sizeof (vname), "card_icon_%05d", ic); + out[vname] = "icon1 imp_offers"; + + snprintf(vname, sizeof (vname), "banner_%05d", ic); + out[vname] ="banner-waiting.jpg"; + + snprintf(vname, sizeof (vname), "banner_location_%05d", ic); + out[vname] ="LOCAL"; + + snprintf(vname, sizeof (vname), "link_path_%05d", ic); + out[vname] = "mytask"; + + snprintf(vname, sizeof (vname), "button_text_%05d", ic); + out[vname] = "Continue"; + + snprintf(vname, sizeof (vname), "short_button_text_%05d", ic); + out[vname] = "short_button_text"; + + snprintf(vname, sizeof (vname), "short_title_%05d", ic); + out[vname] = "Find new task in the market."; + + snprintf(vname, sizeof (vname), "short_description_%05d", ic); + out[vname] = "Find new task in the market"; + + snprintf(vname, sizeof (vname), "short_style_%05d", ic); + out[vname] = "short_style"; + + ret = PHP_API_OK; + } + + + } catch (bad_parameter) { + out["status"] = "ERROR"; + } + logfmt(logINFO, "/RecoStartMarketCard()"); + return ret; +} long RecoCheckOffers(int itm_count, CVars in, CVars &out ){ logfmt(logINFO, "RecoCheckOffers()");