diff --git a/wrenchboard/src/shared_tool/reco_egine.cc b/wrenchboard/src/shared_tool/reco_egine.cc index b02129c1..3e908887 100644 --- a/wrenchboard/src/shared_tool/reco_egine.cc +++ b/wrenchboard/src/shared_tool/reco_egine.cc @@ -44,6 +44,7 @@ long RecoStartMarketCardUS( int itm_count, CVars in, CVars &out ); long RecoLearnMore( int itm_count, CVars in, CVars &out ); long RecoJobOwner( int itm_count, CVars in, CVars &out ); +long RecoFamilyWaiting( int itm_count, CVars in, CVars &out ); long recommendation_engine(long action , CVars in, CVars &out) { try{ @@ -93,6 +94,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( RecoFamilyWaiting( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } if( RecoCheckOffers( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } /*ONLY IF OFFER IS GREATER THAN 2 */ if( RecoCheckActiveTask( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } if( RecoStartMarketCardUS( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } @@ -103,7 +105,7 @@ long WrenchHomeBanners(CVars in, CVars &out) { if(itm_count < 3){ // if you dont have 3 cards let ckeck // active task - if( RecoCheckActiveTask( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } + // if( RecoCheckActiveTask( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } // reward family } @@ -160,6 +162,71 @@ JOBOWNER_HOME_DASH return ret; } +long RecoFamilyWaiting( int itm_count, CVars in, CVars &out ){ + logfmt(logINFO, "RecoFamilyWaiting()"); + 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_family_suggesttask WHERE member_id =%lu AND status IN ( 1,2,3,4,5) ", member_id); + if (res != NULL && pgsql_num_rows(res) > 0) { + + snprintf(vname, sizeof (vname), "title_%05d", ic); + out[vname] = "The family is waiting"; + + snprintf(vname, sizeof (vname), "description_%05d", ic); + out[vname] = "Your kids have recommended some tasks and await your approval to start."; + + snprintf(vname, sizeof (vname), "card_type_%05d", ic); + out[vname] = "KIDS_SUGGEST"; + + 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] ="https://www.wrenchboard.com/assets/images/apps/banners/family-login.jpg"; + out[vname] ="https://www.wrenchboard.com/assets/images/apps/banners/family-waiting.jpg"; + + snprintf(vname, sizeof (vname), "banner_location_%05d", ic); + out[vname] ="URL"; + + snprintf(vname, sizeof (vname), "link_path_%05d", ic); + out[vname] = "acc-family"; + + snprintf(vname, sizeof (vname), "button_text_%05d", ic); + out[vname] = "Continue"; + + snprintf(vname, sizeof (vname), "short_button_text_%05d", ic); + out[vname] = "View"; + + snprintf(vname, sizeof (vname), "short_title_%05d", ic); + out[vname] = "Your family is waiting."; + + snprintf(vname, sizeof (vname), "short_description_%05d", ic); + out[vname] = "Kids are awaiting your approval to start."; + + snprintf(vname, sizeof (vname), "short_style_%05d", ic); + out[vname] = "short_style"; + + ret = PHP_API_OK; + } + + + } catch (bad_parameter) { + out["status"] = "ERROR"; + } + logfmt(logINFO, "/RecoFamilyWaiting()"); + return ret; +return 0; +} long RecoLearnMore( int itm_count, CVars in, CVars &out ){ return 0;