diff --git a/wrenchboard/src/shared_tool/reco_egine.cc b/wrenchboard/src/shared_tool/reco_egine.cc index 7ebc6327..2cdc62c2 100644 --- a/wrenchboard/src/shared_tool/reco_egine.cc +++ b/wrenchboard/src/shared_tool/reco_egine.cc @@ -35,6 +35,7 @@ long RecoCheckTaskReview( int itm_count, CVars in, CVars &out ); 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 recommendation_engine(long action , CVars in, CVars &out) { try{ @@ -75,6 +76,7 @@ long WrenchHomeBanners(CVars in, CVars &out) { long member_id = REQ_LONG(in, "member_id", 1, -1); int itm_count= 0; 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++; } if( RecoCheckFamilyCount( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } if( RecoCheckCoupons( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; } @@ -379,6 +381,71 @@ long RecoReferAFreind(int itm_count, CVars in, CVars &out ){ return ret; } +// + +long RecoPendingInterestCount( int itm_count, CVars in, CVars &out ){ + //SELECT count(id) AS family_count FROM members_family WHERE member_id =1 AND status = 1 AND last_login IS NULL ; + logfmt(logINFO, "RecoCheckFamilyCount()"); + 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 moi.*,mjo.expire FROM members_offer_interest moi LEFT JOIN members_jobs_offer mjo ON mjo.id = moi.offer_id WHERE moi.member_id =1 AND mjo.expire > now()",member_id); + if (res != NULL && pgsql_num_rows(res) == 0) { + + snprintf(vname, sizeof (vname), "title_%05d", ic); + out[vname] = "We are waiting on feedback"; + + snprintf(vname, sizeof (vname), "description_%05d", ic); + out[vname] = "We are waiting on feedback - We are waiting on feedback"; + + snprintf(vname, sizeof (vname), "card_type_%05d", ic); + out[vname] = "PEND_INTEREST"; + + 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"; + + snprintf(vname, sizeof (vname), "banner_%05d", ic); + out[vname] ="https://blog.wrenchboard.com/wp-content/uploads/2022/01/wrechboard-sample.jpg"; + + snprintf(vname, sizeof (vname), "banner_location_%05d", ic); + out[vname] ="URL"; + + snprintf(vname, sizeof (vname), "link_path_%05d", ic); + out[vname] = "pend-interest"; + + snprintf(vname, sizeof (vname), "button_text_%05d", ic); + out[vname] = "Continue"; + + snprintf(vname, sizeof (vname), "short_button_text_%05d", ic); + out[vname] = "Details"; + + snprintf(vname, sizeof (vname), "short_title_%05d", ic); + out[vname] = "We are waiting on feedback"; + + snprintf(vname, sizeof (vname), "short_description_%05d", ic); + out[vname] = "We are waiting on feedback We are waiting on feedback "; + + snprintf(vname, sizeof (vname), "short_style_%05d", ic); + out[vname] = "short_style lb"; + + ret = PHP_API_OK; + } + } catch (bad_parameter) { + out["status"] = "ERROR"; + } + logfmt(logINFO, "/RecoPendingInterestCount()"); + return ret; +} + long RecoCheckFamilyCount( int itm_count, CVars in, CVars &out ){ //SELECT count(id) AS family_count FROM members_family WHERE member_id =1 AND status = 1 AND last_login IS NULL ; logfmt(logINFO, "RecoCheckFamilyCount()");