Interest count

This commit is contained in:
CHIEFSOFT\ameye
2023-06-11 20:22:18 -04:00
parent 55546ada6b
commit e4a0d5f7f9
2 changed files with 36 additions and 3 deletions
+34 -1
View File
@@ -490,10 +490,43 @@ long WrenchReturnJobList(CVars in, CVars &out) {
}
}
/*
wrenchboard=> SELECT count(mo.id),mj.offer_code FROM members_offer_interest mo
LEFT JOIN members_jobs_offer mj ON mj.id= mo.offer_id WHERE mj.expire > now() GROUP BY mj.offer_code
wrenchboard-> ;
count | offer_code
-------+------------
3 | 1B7R3134W0
3 | 66WW5B9B45
3 | Y1X0983WTP
(3 rows)
*/
const PGresult *res2;
res2 = pgsql_query("SELECT count(mo.id) AS interest_count,mj.offer_code FROM members_offer_interest mo "
" LEFT JOIN members_jobs_offer mj ON mj.id= mo.offer_id "
" WHERE mj.expire > now() GROUP BY mj.offer_code");
if (res2 != NULL && pgsql_num_rows(res2) > 0) {
out["total_interest_record"] = pgsql_num_rows(res2);
for (int ii = 0, n = pgsql_num_rows(res2); ii < n; ii++) {
map<const char*, const char*>f2 = pgsql_fetch_assoc(res2, ii);
if (f2.empty()) continue;
CVars rec2;
map_to_cvars(f2, rec2);
snprintf(vname, sizeof (vname), "interest_count_%s", rec2["offer_code"].c_str());
out[vname] = rec2["interest_count"];
}
}
ret = PHP_API_OK;
out["status"] = "OK";
} catch (bad_parameter) {
logfmt(logINFO, "ERROR CALL long medTrReasonList(CVars in, CVars &out)");
logfmt(logINFO, "ERROR CALL long WrenchReturnJobList(CVars in, CVars &out)");
}
logfmt(logINFO, "/WrenchReturnJobList()");
return ret;
+2 -2
View File
@@ -164,7 +164,7 @@ long RecoOffersInterest(int itm_count, CVars in, CVars &out ){
out[vname] = "Continue";
snprintf(vname, sizeof (vname), "short_button_text_%05d", ic);
out[vname] = "short_button_text";
out[vname] = "View now";
snprintf(vname, sizeof (vname), "short_title_%05d", ic);
out[vname] = "Interest Pending";
@@ -259,7 +259,7 @@ long RecoCheckFamilyLogin(int itm_count, CVars in, CVars &out ){
try {
int ic = itm_count;
long member_id = REQ_LONG(in, "member_id", 1, -1);
res = pgsql_query("SELECT count(id) AS family_count FROM members_family WHERE member_id = %lu AND status = 1 AND last_login IS NULL ",member_id);
res = pgsql_query("SELECT id FROM members_family WHERE member_id = %lu AND status = 1 AND last_login IS NULL ",member_id);
if (res != NULL && pgsql_num_rows(res) > 0) {
snprintf(vname, sizeof (vname), "title_%05d", ic);