This commit is contained in:
CHIEFSOFT\ameye
2023-05-30 16:13:38 -04:00
parent bca0348a37
commit 557e1abd96
+68 -65
View File
@@ -70,38 +70,47 @@ long WrenchHomeBanners(CVars in, CVars &out) {
out["status"] = "long WrenchHomeBanners(CVars in, CVars &out)";
CVars offV;
char vname[30];
WrenchReturnJobOffersList(in, offV);
long total_offers = offV["total_record"].Long();
if( total_offers > 0){
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( 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++; }
//if( RecoCheckTaskDue( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; }
if( RecoCheckBlog( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; }
for (int i = 0, n = total_offers; i < n; i++) {
snprintf(vname, sizeof (vname), "title_%05d", i);
out[vname] = offV[vname];
snprintf(vname, sizeof (vname), "card_style_%05d", i);
out[vname] = offV[vname];
snprintf(vname, sizeof (vname), "description_%05d", i);
out[vname] = offV[vname];
snprintf(vname, sizeof (vname), "card_type_%05d", i);
out[vname] = "OFFERS";
snprintf(vname, sizeof (vname), "offer_id_%05d", i);
out[vname] = offV[vname];
snprintf(vname, sizeof (vname), "blog_id_%05d", i);
out[vname] = "0";
snprintf(vname, sizeof (vname), "card_icon_%05d", i);
out[vname] = "icon1";
snprintf(vname, sizeof (vname), "contract_%05d", i);
out[vname] = offV[vname];;
}
}
// WrenchReturnJobOffersList(in, offV);
// long total_offers = offV["total_record"].Long();
// if( total_offers > 0){
//
// for (int i = 0, n = total_offers; i < n; i++) {
//
// snprintf(vname, sizeof (vname), "title_%05d", i);
// out[vname] = offV[vname];
//
// snprintf(vname, sizeof (vname), "card_style_%05d", i);
// out[vname] = offV[vname];
//
// snprintf(vname, sizeof (vname), "description_%05d", i);
// out[vname] = offV[vname];
//
// snprintf(vname, sizeof (vname), "card_type_%05d", i);
// out[vname] = "OFFERS";
//
// snprintf(vname, sizeof (vname), "offer_id_%05d", i);
// out[vname] = offV[vname];
//
// snprintf(vname, sizeof (vname), "blog_id_%05d", i);
// out[vname] = "0";
//
// snprintf(vname, sizeof (vname), "card_icon_%05d", i);
// out[vname] = "icon1";
//
// snprintf(vname, sizeof (vname), "contract_%05d", i);
// out[vname] = offV[vname];;
//
// }
// }
out["total_record"] = total_offers;
return 0;
@@ -114,41 +123,35 @@ long RecoCheckOffers(int itm_count, CVars in, CVars &out ){
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_jobs_offer WHERE expire > now() AND status = 1 AND client_id = %lu ",member_id);
if (res != NULL && pgsql_num_rows(res) > 0) {
snprintf(vname, sizeof (vname), "title_%05d", ic);
out[vname] = "This is the offer available text";
snprintf(vname, sizeof (vname), "description_%05d", ic);
out[vname] = "This is the offer available text DESCRIPTIOON - This is the offer available text";
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";
ret = PHP_API_OK;
}
// res = pgsql_query("SELECT * FROM members_jobs_offer WHERE expire > now() AND status = 1 AND client_id = %lu ",member_id);
// if (res != NULL && pgsql_num_rows(res) > 0) {
//
// snprintf(vname, sizeof (vname), "title_%05d", ic);
// out[vname] = "This is the offer available text";
//
// snprintf(vname, sizeof (vname), "description_%05d", ic);
// out[vname] = "This is the offer available text DESCRIPTIOON - This is the offer available text";
//
// 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", i);
// out[vname] ="https://blog.wrenchboard.com/wp-content/uploads/2022/01/wrechboard-sample.jpg";
//
// ret = PHP_API_OK;
// }
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( 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++; }
//if( RecoCheckTaskDue( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; }
if( RecoCheckBlog( itm_count, in, out ) != PHP_API_BAD_PARAM ) { itm_count++; }
} catch (bad_parameter) {
out["status"] = "ERROR";