This commit is contained in:
CHIEFSOFT\ameye
2023-12-07 17:48:55 -05:00
parent b2641e8834
commit 1dfabbd3b6
+7 -15
View File
@@ -91,8 +91,8 @@ long sitecrons_calls(CVars in, CVars &out) {
break;
case WRB_CRONJOB_NOTIFICATIONS:
ct["job_type"]="WRB_CRONJOB_PENDOFFER_ALERT"; ct["job_type"].set_valid( true );
ct["description"]="Offer is pending remind the client to attend to it before it expires "; ct["description"].set_valid( true );
ct["job_type"]="WRB_CRONJOB_NOTIFICATIONS"; ct["job_type"].set_valid( true );
ct["description"]="Notification System "; ct["description"].set_valid( true );
CronTracker(ct, co);
return NotificationSystem(in, out);
@@ -107,9 +107,10 @@ long sitecrons_calls(CVars in, CVars &out) {
long NotificationSystem(CVars in, CVars &out){
long ret = 0;
const PGresult *res;
long limit = in["one_limit"].Long();
long limit = in["limit"].Long();
logfmt(logINFO, "ENTER NotificationSystem()");
long contract_id = 0;
long push_ret = -1;
const PGresult *res = pgsql_query("SELECT count(member_uid) AS mcount,member_uid "
" FROM members_notification WHERE status=1 GROUP BY member_uid LIMIT %lu",limit);
if (res != NULL && pgsql_num_rows(res) > 0) {
@@ -118,21 +119,14 @@ long NotificationSystem(CVars in, CVars &out){
if (f.empty()) continue;
CVars rec;
map_to_cvars(f, rec);
/*
wrenchboard=> SELECT uid,member_uid,msg FROM members_notification WHERE status =1 AND member_uid = '7b66905e-b2c4-4ae3-9b32-83aa50d4d0f5' ORDER BY id DESC LIMIT 1;
uid | member_uid | msg
--------------------------------------+--------------------------------------+---------------------------------------------------------
40a675fc-8073-4fb7-8b81-2fa699779e54 | 7b66905e-b2c4-4ae3-9b32-83aa50d4d0f5 | You have received a new offer waiting for you to start!
(1 row)
*/
if ( load_db_record(out, "SELECT id AS notification_id, uid,member_uid,msg FROM members_notification "
" WHERE status =1 AND member_uid = '%s' ORDER BY id DESC LIMIT 1", rec["member_uid"].c_str())> 0){
CVars xx;
xx["member_uid"] = out["member_uid"]; xx["member_uid"].set_valid( true );
xx["push_text"] = out["msg"]; xx["push_text"].set_valid( true );
long push_ret = BkoSendPush( xx, out);
push_ret = BkoSendPush( xx, out);
if (push_ret == PHP_API_OK){
xx["send_result"] = "COMPLETED"; xx["send_result"].set_valid( true );
@@ -144,10 +138,8 @@ wrenchboard=> SELECT uid,member_uid,msg FROM members_notification WHERE status
pgsql_query("UPDATE members_notification SET send=now(), send_result='%s' "
" WHERE id = %lu", out["notification_id"].Long(),xx["send_result"].c_str());
}
}
}
} // for loopp
} // main nserach
return ret;
}