promo rtecords

This commit is contained in:
CHIEFSOFT\ameye
2024-11-23 11:19:44 -05:00
parent 69d601c1b9
commit caad097517
+27 -1
View File
@@ -198,7 +198,9 @@ long RefreshPromoActivities(CVars in, CVars &out){
long ret = PHP_API_BAD_PARAM;
try {
out["total_record"] = "0";
const PGresult *res;
const PGresult *res, *resF;
// check if pending
res = pgsql_query("SELECT * FROM promo_member WHERE status = 1 ORDER BY id DESC LIMIT 20");
if (res != NULL && pgsql_num_rows(res) > 0) {
out["total_record"] = pgsql_num_rows(res);
@@ -209,11 +211,35 @@ long RefreshPromoActivities(CVars in, CVars &out){
CVars rec;
map_to_cvars(f, rec);
// check if on pending table
resF = pgsql_query("SELECT status FROM members_pending where LOWER(username)= LOWER('%s')", rec["email"].c_star());
if (resF != NULL && pgsql_num_rows(resF) > 0) {
pgsql_query("UPDATE promo_member SET updated = now(), status=2 WHERE id = %lu ", rec["id"].Long()); // mo
}
}
}
// check if signup
res = pgsql_query("SELECT * FROM promo_member WHERE status = 2 ORDER BY id DESC LIMIT 20");
if (res != NULL && pgsql_num_rows(res) > 0) {
out["total_record"] = pgsql_num_rows(res);
for (int i = 0, n = pgsql_num_rows(res); i < n; i++) {
map<const char*, const char*>f = pgsql_fetch_assoc(res, i);
if (f.empty()) continue;
CVars rec;
map_to_cvars(f, rec);
// check if on pending table
resF = pgsql_query("SELECT status FROM members where LOWER(username)= LOWER('%s')", rec["email"].c_star());
if (resF != NULL && pgsql_num_rows(resF) > 0) {
pgsql_query("UPDATE promo_member SET updated = now(), status=3 WHERE id = %lu ", rec["id"].Long()); // mo
}
}
}
// send reports to admins
res = pgsql_query("SELECT * FROM promo_admin WHERE status = 1 ORDER BY updated ASC LIMIT 20");
if (res != NULL && pgsql_num_rows(res) > 0) {
out["total_record"] = pgsql_num_rows(res);