Offer Interest logic

This commit is contained in:
CHIEFSOFT\ameye
2023-06-11 18:21:29 -04:00
parent 02d32703a9
commit 55546ada6b
+67
View File
@@ -33,6 +33,7 @@ long RecoCheckCoupons( int itm_count, CVars in, CVars &out );
long RecoCheckTaskDue( int itm_count, CVars in, CVars &out );
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 recommendation_engine(long action , CVars in, CVars &out) {
@@ -80,6 +81,8 @@ long WrenchHomeBanners(CVars in, CVars &out) {
if( RecoCheckTaskReview( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; }
if( RecoCheckTaskDue( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; }
if( RecoCheckBlog( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; }
if( RecoOffersInterest( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; }
// WrenchReturnJobOffersList(in, offV);
// long total_offers = offV["total_record"].Long();
@@ -117,7 +120,71 @@ long WrenchHomeBanners(CVars in, CVars &out) {
out["total_record"] = itm_count;
return 0;
}
//
long RecoOffersInterest(int itm_count, CVars in, CVars &out ){
logfmt(logINFO, "RecoOffersInterest()");
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 mo.* FROm members_offer_interest mo LEFT JOIN members_jobs_offer mj ON mj.id= mo.offer_id"
" WHERE mj.member_id = %lu AND mj.expire > now()",member_id);
if (res != NULL && pgsql_num_rows(res) > 0) {
snprintf(vname, sizeof (vname), "title_%05d", ic);
out[vname] = "Some interest waiting for your job(s)";
snprintf(vname, sizeof (vname), "description_%05d", ic);
out[vname] = "Some interest waiting for your job(s) Some interest waiting for your job(s)";
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";
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] = "offer-interest";
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] = "Interest Pending";
snprintf(vname, sizeof (vname), "short_description_%05d", ic);
out[vname] = "Some interest waiting for your job(s)";
snprintf(vname, sizeof (vname), "short_style_%05d", ic);
out[vname] = "short_style ly";
ret = PHP_API_OK;
}
} catch (bad_parameter) {
out["status"] = "ERROR";
}
logfmt(logINFO, "/RecoOffersInterest()");
return ret;
}
long RecoCheckOffers(int itm_count, CVars in, CVars &out ){
logfmt(logINFO, "RecoCheckOffers()");